feat: progress

This commit is contained in:
2025-12-23 23:55:44 -05:00
parent 647b79a050
commit 6db53a1fb9
2 changed files with 129 additions and 0 deletions

View File

@@ -0,0 +1,44 @@
package car_fleet_test
import (
"testing"
"git.maximhutz.com/practice/pkg/car_fleet"
"github.com/stretchr/testify/assert"
)
func Test1(t *testing.T) {
target := 12
position := []int{10, 8, 0, 5, 3}
speed := []int{2, 4, 1, 1, 3}
output := 3
assert.Equal(t, output, car_fleet.CarFleet(target, position, speed))
}
func Test2(t *testing.T) {
target := 10
position := []int{3}
speed := []int{3}
output := 1
assert.Equal(t, output, car_fleet.CarFleet(target, position, speed))
}
func Test3(t *testing.T) {
target := 100
position := []int{0, 2, 4}
speed := []int{4, 2, 1}
output := 1
assert.Equal(t, output, car_fleet.CarFleet(target, position, speed))
}
func Test4(t *testing.T) {
target := 10
position := []int{6, 8}
speed := []int{3, 2}
output := 2
assert.Equal(t, output, car_fleet.CarFleet(target, position, speed))
}