Initialise
This commit is contained in:
parent
3ff7f9b0b9
commit
0941f68e91
700 changed files with 27489 additions and 0 deletions
26
flatten-array/flatten_array_test.go
Normal file
26
flatten-array/flatten_array_test.go
Normal file
|
@ -0,0 +1,26 @@
|
|||
package flatten
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestFlatten(t *testing.T) {
|
||||
for _, tc := range testCases {
|
||||
if actual := Flatten(tc.input); !reflect.DeepEqual(actual, tc.expected) {
|
||||
t.Fatalf("FAIL: %s\nExpected: %v\nActual: %v", tc.description, tc.expected, actual)
|
||||
}
|
||||
t.Logf("PASS: %s", tc.description)
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkFlatten(b *testing.B) {
|
||||
if testing.Short() {
|
||||
b.Skip("skipping benchmark in short mode.")
|
||||
}
|
||||
for i := 0; i < b.N; i++ {
|
||||
for _, tc := range testCases {
|
||||
Flatten(tc.input)
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue