示例#1
0
func TestSolve2Sum1(t *testing.T) {
	target := 25
	array := common.GenerateArray(target)
	pair := sum2.Solve(target, array)
	sum := sumPair(array, pair)
	if sum != target {
		t.Fatalf("Error, wront value. %d vs %d", sum, target)
	}
}
示例#2
0
func TestGenerator2048Elements(t *testing.T) {
	arrayOf2048 := common.GenerateArray(2048)
	if len(*arrayOf2048) != 2048 {
		t.Fatalf("Error, wront size. %d ", len(*arrayOf2048))
	}
}
示例#3
0
func TestGenerator1024Elements(t *testing.T) {
	arrayOf1024 := common.GenerateArray(1024)
	if len(*arrayOf1024) != 1024 {
		t.Fatalf("Error, wront size. %d ", len(*arrayOf1024))
	}
}
示例#4
0
func TestGenerator5Elements(t *testing.T) {
	arrayOf5 := common.GenerateArray(5)
	if len(*arrayOf5) != 5 {
		t.Fatalf("Error, wront size. %d ", len(*arrayOf5))
	}
}