feat: progress
This commit is contained in:
44
pkg/car_fleet/main_test.go
Normal file
44
pkg/car_fleet/main_test.go
Normal 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))
|
||||
}
|
||||
Reference in New Issue
Block a user