mirror of
https://github.com/rjNemo/underscore
synced 2026-06-06 10:36:43 +00:00
Created a Tuple struct as some of the new functions require you to return a new slice with two fields which is the result of the new functions Created the Join, JoinProjection, Range, SumMap, Zip functions, ecah fuction is documented with how it works and had a unit test or maybe more
24 lines
494 B
Go
24 lines
494 B
Go
package underscore_test
|
|
|
|
import (
|
|
"reflect"
|
|
"testing"
|
|
|
|
u "github.com/rjNemo/underscore"
|
|
)
|
|
|
|
func Test_Range_Creates_Slices(t *testing.T) {
|
|
range1 := u.Range(0, 5)
|
|
want1 := []int{0, 1, 2, 3, 4, 5}
|
|
|
|
if !reflect.DeepEqual(range1, want1) {
|
|
t.Errorf("Expected the result to be %v but we got %v", want1, range1)
|
|
}
|
|
|
|
range2 := u.Range(5, 0)
|
|
want2 := []int{5, 4, 3, 2, 1, 0}
|
|
|
|
if !reflect.DeepEqual(range2, want2) {
|
|
t.Errorf("Expected the result to be %v but we got %v", want2, range2)
|
|
}
|
|
}
|