diff --git a/tests/go/advancedsortwordarr_test.go b/tests/go/advancedsortwordarr_test.go index 0716c9e7..81c4fb3b 100644 --- a/tests/go/advancedsortwordarr_test.go +++ b/tests/go/advancedsortwordarr_test.go @@ -32,7 +32,7 @@ func TestAdvancedSortWordArr(t *testing.T) { student.AdvancedSortWordArr(cp_stu, solutions.CompArray) if !reflect.DeepEqual(cp_stu, cp_sol) { - t.Errorf("%s(%v) == %v instead of %v\n", + t.Fatalf("%s(%v) == %v instead of %v\n", "AdvancedSortWordArr", org, cp_stu, diff --git a/tests/go/btreedeletenode_test.go b/tests/go/btreedeletenode_test.go index ba60fc7e..2e58513b 100644 --- a/tests/go/btreedeletenode_test.go +++ b/tests/go/btreedeletenode_test.go @@ -82,7 +82,7 @@ func formatSubTree_delete(root *student.TreeNode, prefix string) string { } func errorMessage_delete(t *testing.T, fn interface{}, deleted string, rootOr, root *solutions.TreeNode, rootS *student.TreeNode) { - t.Errorf("%s(\n%s, %s\n) ==\n%s instead of\n%s\n", + t.Fatalf("%s(\n%s, %s\n) ==\n%s instead of\n%s\n", z01.NameOfFunc(fn), solutions.FormatTree(rootOr), deleted, diff --git a/tests/go/btreeinsertdata_test.go b/tests/go/btreeinsertdata_test.go index f97f261d..3d786f61 100644 --- a/tests/go/btreeinsertdata_test.go +++ b/tests/go/btreeinsertdata_test.go @@ -82,7 +82,7 @@ func formatSubTree_insert(root *student.TreeNode, prefix string) string { } func errorMessage_insert(t *testing.T, fn interface{}, inserted string, root *solutions.TreeNode, rootS *student.TreeNode) { - t.Errorf("%s(\n%s, %s\n) ==\n%s instead of\n%s\n", + t.Fatalf("%s(\n%s, %s\n) ==\n%s instead of\n%s\n", z01.NameOfFunc(fn), solutions.FormatTree(root), inserted, diff --git a/tests/go/btreeisbinary_test.go b/tests/go/btreeisbinary_test.go index 66cee7fe..c9cce3d0 100644 --- a/tests/go/btreeisbinary_test.go +++ b/tests/go/btreeisbinary_test.go @@ -19,7 +19,7 @@ func BTreeMinStu(root *student.TreeNode) *student.TreeNode { } func errorMessage_isbin(t *testing.T, fn interface{}, root, a *solutions.TreeNode, b *student.TreeNode) { - t.Errorf("%s(\n%s\n) == %s instead of %s\n", + t.Fatalf("%s(\n%s\n) == %s instead of %s\n", z01.NameOfFunc(fn), solutions.FormatTree(root), b.Data, @@ -29,7 +29,7 @@ func errorMessage_isbin(t *testing.T, fn interface{}, root, a *solutions.TreeNod func CompareNode_isbin(t *testing.T, fn interface{}, arg1, a *solutions.TreeNode, b *student.TreeNode) { if a == nil || b == nil { - t.Errorf("Expected %v instead of %v\n", a, b) + t.Fatalf("Expected %v instead of %v\n", a, b) return } @@ -40,28 +40,28 @@ func CompareNode_isbin(t *testing.T, fn interface{}, arg1, a *solutions.TreeNode if a.Parent != nil && b.Parent != nil { if a.Parent.Data != b.Parent.Data { errorMessage_isbin(t, fn, arg1, a, b) - t.Errorf("Expected parent value %v instead of %v\n", a.Parent.Data, b.Parent.Data) + t.Fatalf("Expected parent value %v instead of %v\n", a.Parent.Data, b.Parent.Data) } } else if (a.Parent == nil && b.Parent != nil) || (a.Parent != nil && b.Parent == nil) { - t.Errorf("Expected parent value %v instead of %v\n", a.Parent, b.Parent) + t.Fatalf("Expected parent value %v instead of %v\n", a.Parent, b.Parent) } if a.Right != nil && b.Right != nil { if a.Right.Data != b.Right.Data { errorMessage_isbin(t, fn, arg1, a, b) - t.Errorf("Expected right child value %v instead of %v\n", a.Right.Data, b.Right.Data) + t.Fatalf("Expected right child value %v instead of %v\n", a.Right.Data, b.Right.Data) } } else if (a.Right == nil && b.Right != nil) || (a.Right != nil && b.Right == nil) { - t.Errorf("Expected right child value %v instead of %v\n", a.Right, b.Right) + t.Fatalf("Expected right child value %v instead of %v\n", a.Right, b.Right) } if a.Left != nil && b.Left != nil { if a.Left.Data != b.Left.Data { errorMessage_isbin(t, fn, arg1, a, b) - t.Errorf("Expected left child value %v instead of %v\n", a.Left, b.Left) + t.Fatalf("Expected left child value %v instead of %v\n", a.Left, b.Left) } } else if (a.Left == nil && b.Left != nil) || (a.Left != nil && b.Left == nil) { - t.Errorf("Expected left child value %v instead of %v\n", a, b) + t.Fatalf("Expected left child value %v instead of %v\n", a, b) } } @@ -78,7 +78,7 @@ func CompareReturn_isbin(t *testing.T, fn1, fn2 interface{}, arg1 *solutions.Tre CompareNode_isbin(t, fn1, arg1, str, out2.Results[i].(*student.TreeNode)) default: if !reflect.DeepEqual(str, out2.Results[i]) { - t.Errorf("%s(\n%s) == %s instead of %s\n", + t.Fatalf("%s(\n%s) == %s instead of %s\n", z01.NameOfFunc(fn1), solutions.FormatTree(arg1), z01.Format(out2.Results...), diff --git a/tests/go/btreelevelcount_test.go b/tests/go/btreelevelcount_test.go index 82a3177a..d8b794cb 100644 --- a/tests/go/btreelevelcount_test.go +++ b/tests/go/btreelevelcount_test.go @@ -11,7 +11,7 @@ import ( ) func errorMessage_level(t *testing.T, fn interface{}, root, a *solutions.TreeNode, b *student.TreeNode) { - t.Errorf("%s(\n%s\n) == %s instead of %s\n", + t.Fatalf("%s(\n%s\n) == %s instead of %s\n", z01.NameOfFunc(fn), solutions.FormatTree(root), b.Data, @@ -21,7 +21,7 @@ func errorMessage_level(t *testing.T, fn interface{}, root, a *solutions.TreeNod func CompareNode_level(t *testing.T, fn interface{}, arg1, a *solutions.TreeNode, b *student.TreeNode) { if a == nil || b == nil { - t.Errorf("Expected %v instead of %v\n", a, b) + t.Fatalf("Expected %v instead of %v\n", a, b) return } @@ -32,28 +32,28 @@ func CompareNode_level(t *testing.T, fn interface{}, arg1, a *solutions.TreeNode if a.Parent != nil && b.Parent != nil { if a.Parent.Data != b.Parent.Data { errorMessage_level(t, fn, arg1, a, b) - t.Errorf("Expected parent value %v instead of %v\n", a.Parent.Data, b.Parent.Data) + t.Fatalf("Expected parent value %v instead of %v\n", a.Parent.Data, b.Parent.Data) } } else if (a.Parent == nil && b.Parent != nil) || (a.Parent != nil && b.Parent == nil) { - t.Errorf("Expected parent value %v instead of %v\n", a.Parent, b.Parent) + t.Fatalf("Expected parent value %v instead of %v\n", a.Parent, b.Parent) } if a.Right != nil && b.Right != nil { if a.Right.Data != b.Right.Data { errorMessage_level(t, fn, arg1, a, b) - t.Errorf("Expected right child value %v instead of %v\n", a.Right.Data, b.Right.Data) + t.Fatalf("Expected right child value %v instead of %v\n", a.Right.Data, b.Right.Data) } } else if (a.Right == nil && b.Right != nil) || (a.Right != nil && b.Right == nil) { - t.Errorf("Expected right child value %v instead of %v\n", a.Right, b.Right) + t.Fatalf("Expected right child value %v instead of %v\n", a.Right, b.Right) } if a.Left != nil && b.Left != nil { if a.Left.Data != b.Left.Data { errorMessage_level(t, fn, arg1, a, b) - t.Errorf("Expected left child value %v instead of %v\n", a.Left, b.Left) + t.Fatalf("Expected left child value %v instead of %v\n", a.Left, b.Left) } } else if (a.Left == nil && b.Left != nil) || (a.Left != nil && b.Left == nil) { - t.Errorf("Expected left child value %v instead of %v\n", a, b) + t.Fatalf("Expected left child value %v instead of %v\n", a, b) } } @@ -70,7 +70,7 @@ func CompareReturn_level(t *testing.T, fn1, fn2 interface{}, arg1 *solutions.Tre CompareNode_level(t, fn1, arg1, str, out2.Results[i].(*student.TreeNode)) default: if !reflect.DeepEqual(str, out2.Results[i]) { - t.Errorf("%s(\n%s) == %s instead of %s\n", + t.Fatalf("%s(\n%s) == %s instead of %s\n", z01.NameOfFunc(fn1), solutions.FormatTree(arg1), z01.Format(out2.Results...), diff --git a/tests/go/btreemax_test.go b/tests/go/btreemax_test.go index 5382921d..0622c935 100644 --- a/tests/go/btreemax_test.go +++ b/tests/go/btreemax_test.go @@ -11,7 +11,7 @@ import ( ) func errorMessage_max(t *testing.T, fn interface{}, root, a *solutions.TreeNode, b *student.TreeNode) { - t.Errorf("%s(\n%s) == %s instead of %s\n", + t.Fatalf("%s(\n%s) == %s instead of %s\n", z01.NameOfFunc(fn), solutions.FormatTree(root), b.Data, @@ -21,7 +21,7 @@ func errorMessage_max(t *testing.T, fn interface{}, root, a *solutions.TreeNode, func CompareNode_max(t *testing.T, fn interface{}, arg1, a *solutions.TreeNode, b *student.TreeNode) { if a == nil || b == nil { - t.Errorf("Expected %v instead of %v\n", a, b) + t.Fatalf("Expected %v instead of %v\n", a, b) return } @@ -32,28 +32,28 @@ func CompareNode_max(t *testing.T, fn interface{}, arg1, a *solutions.TreeNode, if a.Parent != nil && b.Parent != nil { if a.Parent.Data != b.Parent.Data { errorMessage_max(t, fn, arg1, a, b) - t.Errorf("Expected parent value %v instead of %v\n", a.Parent.Data, b.Parent.Data) + t.Fatalf("Expected parent value %v instead of %v\n", a.Parent.Data, b.Parent.Data) } } else if (a.Parent == nil && b.Parent != nil) || (a.Parent != nil && b.Parent == nil) { - t.Errorf("Expected parent value %v instead of %v\n", a.Parent, b.Parent) + t.Fatalf("Expected parent value %v instead of %v\n", a.Parent, b.Parent) } if a.Right != nil && b.Right != nil { if a.Right.Data != b.Right.Data { errorMessage_max(t, fn, arg1, a, b) - t.Errorf("Expected right child value %v instead of %v\n", a.Right.Data, b.Right.Data) + t.Fatalf("Expected right child value %v instead of %v\n", a.Right.Data, b.Right.Data) } } else if (a.Right == nil && b.Right != nil) || (a.Right != nil && b.Right == nil) { - t.Errorf("Expected right child value %v instead of %v\n", a.Right, b.Right) + t.Fatalf("Expected right child value %v instead of %v\n", a.Right, b.Right) } if a.Left != nil && b.Left != nil { if a.Left.Data != b.Left.Data { errorMessage_max(t, fn, arg1, a, b) - t.Errorf("Expected left child value %v instead of %v\n", a.Left, b.Left) + t.Fatalf("Expected left child value %v instead of %v\n", a.Left, b.Left) } } else if (a.Left == nil && b.Left != nil) || (a.Left != nil && b.Left == nil) { - t.Errorf("Expected left child value %v instead of %v\n", a, b) + t.Fatalf("Expected left child value %v instead of %v\n", a, b) } } @@ -70,7 +70,7 @@ func CompareReturn_max(t *testing.T, fn1, fn2 interface{}, arg1 *solutions.TreeN CompareNode_max(t, fn1, arg1, str, out2.Results[i].(*student.TreeNode)) default: if !reflect.DeepEqual(str, out2.Results[i]) { - t.Errorf("%s(\n%s) == %s instead of\n %s\n", + t.Fatalf("%s(\n%s) == %s instead of\n %s\n", z01.NameOfFunc(fn1), solutions.FormatTree(arg1), z01.Format(out2.Results...), diff --git a/tests/go/btreemin_test.go b/tests/go/btreemin_test.go index e4f97c57..1478c77c 100644 --- a/tests/go/btreemin_test.go +++ b/tests/go/btreemin_test.go @@ -11,7 +11,7 @@ import ( ) func errorMessage_min(t *testing.T, fn interface{}, root, a *solutions.TreeNode, b *student.TreeNode) { - t.Errorf("%s(\n%s) == %s instead of %s\n", + t.Fatalf("%s(\n%s) == %s instead of %s\n", z01.NameOfFunc(fn), solutions.FormatTree(root), b.Data, @@ -21,7 +21,7 @@ func errorMessage_min(t *testing.T, fn interface{}, root, a *solutions.TreeNode, func CompareNode_min(t *testing.T, fn interface{}, arg1, a *solutions.TreeNode, b *student.TreeNode) { if a == nil || b == nil { - t.Errorf("Expected %v instead of %v\n", a, b) + t.Fatalf("Expected %v instead of %v\n", a, b) return } @@ -32,28 +32,28 @@ func CompareNode_min(t *testing.T, fn interface{}, arg1, a *solutions.TreeNode, if a.Parent != nil && b.Parent != nil { if a.Parent.Data != b.Parent.Data { errorMessage_min(t, fn, arg1, a, b) - t.Errorf("Expected parent value %v instead of %v\n", a.Parent.Data, b.Parent.Data) + t.Fatalf("Expected parent value %v instead of %v\n", a.Parent.Data, b.Parent.Data) } } else if (a.Parent == nil && b.Parent != nil) || (a.Parent != nil && b.Parent == nil) { - t.Errorf("Expected parent value %v instead of %v\n", a.Parent, b.Parent) + t.Fatalf("Expected parent value %v instead of %v\n", a.Parent, b.Parent) } if a.Right != nil && b.Right != nil { if a.Right.Data != b.Right.Data { errorMessage_min(t, fn, arg1, a, b) - t.Errorf("Expected right child value %v instead of %v\n", a.Right.Data, b.Right.Data) + t.Fatalf("Expected right child value %v instead of %v\n", a.Right.Data, b.Right.Data) } } else if (a.Right == nil && b.Right != nil) || (a.Right != nil && b.Right == nil) { - t.Errorf("Expected right child value %v instead of %v\n", a.Right, b.Right) + t.Fatalf("Expected right child value %v instead of %v\n", a.Right, b.Right) } if a.Left != nil && b.Left != nil { if a.Left.Data != b.Left.Data { errorMessage_min(t, fn, arg1, a, b) - t.Errorf("Expected left child value %v instead of %v\n", a.Left, b.Left) + t.Fatalf("Expected left child value %v instead of %v\n", a.Left, b.Left) } } else if (a.Left == nil && b.Left != nil) || (a.Left != nil && b.Left == nil) { - t.Errorf("Expected left child value %v instead of %v\n", a, b) + t.Fatalf("Expected left child value %v instead of %v\n", a, b) } } @@ -70,7 +70,7 @@ func CompareReturn_min(t *testing.T, fn1, fn2, arg1, arg2 interface{}) { CompareNode_min(t, fn1, arg1.(*solutions.TreeNode), str, out2.Results[i].(*student.TreeNode)) default: if !reflect.DeepEqual(str, out2.Results[i]) { - t.Errorf("%s(%s) == %s instead of %s\n", + t.Fatalf("%s(%s) == %s instead of %s\n", z01.NameOfFunc(fn1), z01.Format(arg1), z01.Format(out2.Results...), diff --git a/tests/go/btreerotateleft_test.go b/tests/go/btreerotateleft_test.go index ae145654..983fb301 100644 --- a/tests/go/btreerotateleft_test.go +++ b/tests/go/btreerotateleft_test.go @@ -83,7 +83,7 @@ func formatSubTree_rotleft(root *student.TreeNode, prefix string) string { } func errorMessage_rotleft(t *testing.T, fn interface{}, rootOr, root *solutions.TreeNode, rootS *student.TreeNode) { - t.Errorf("%s(\n%s\n)\n == \n%s instead of \n%s\n", + t.Fatalf("%s(\n%s\n)\n == \n%s instead of \n%s\n", z01.NameOfFunc(fn), solutions.FormatTree(rootOr), FormatTree_rotleft(rootS), @@ -96,7 +96,7 @@ func CompareTreesRotLeft(t *testing.T, fn interface{}, root, rootA *solutions.Tr parentStu := parentListRotLeft(rootAS) solTree := solutions.FormatTree(root) if parentSol != parentStu { - t.Errorf("Tree:\n%s\nExpected\n%s instead of\n%s\n", solTree, parentSol, parentStu) + t.Fatalf("Tree:\n%s\nExpected\n%s instead of\n%s\n", solTree, parentSol, parentStu) } } @@ -122,7 +122,7 @@ func CompareReturn_rotleft(t *testing.T, fn1, fn2, rootOr, arg1, arg2 interface{ CompareNode_rotleft(t, fn1, rootOr.(*solutions.TreeNode), str, out2.Results[i].(*student.TreeNode)) default: if !reflect.DeepEqual(str, out2.Results[i]) { - t.Errorf("%s(%s) == %s instead of %s\n", + t.Fatalf("%s(%s) == %s instead of %s\n", z01.NameOfFunc(fn1), z01.Format(arg1), z01.Format(out2.Results...), diff --git a/tests/go/btreerotateright_test.go b/tests/go/btreerotateright_test.go index f611bbe6..74f241c7 100644 --- a/tests/go/btreerotateright_test.go +++ b/tests/go/btreerotateright_test.go @@ -33,7 +33,7 @@ func CompareTreesRotRight(t *testing.T, fn interface{}, root, rootA *solutions.T parentStu := parentListRotRight(rootAS) solTree := solutions.FormatTree(root) if parentSol != parentStu { - t.Errorf("Tree:\n%s\nExpected\n%s instead of\n%s\n", solTree, parentSol, parentStu) + t.Fatalf("Tree:\n%s\nExpected\n%s instead of\n%s\n", solTree, parentSol, parentStu) } } @@ -92,7 +92,7 @@ func formatSubTree_rotright(root *student.TreeNode, prefix string) string { } func errorMessage_rotright(t *testing.T, fn interface{}, rootOr, root *solutions.TreeNode, rootS *student.TreeNode) { - t.Errorf("%s(\n%s\n)\n == \n%s instead of \n%s\n", + t.Fatalf("%s(\n%s\n)\n == \n%s instead of \n%s\n", z01.NameOfFunc(fn), solutions.FormatTree(rootOr), FormatTree_rotright(rootS), @@ -122,7 +122,7 @@ func CompareReturn_rotright(t *testing.T, fn1, fn2, rootOr, arg1, arg2 interface CompareNode_rotright(t, fn1, rootOr.(*solutions.TreeNode), str, out2.Results[i].(*student.TreeNode)) default: if !reflect.DeepEqual(str, out2.Results[i]) { - t.Errorf("%s(%s) == %s instead of %s\n", + t.Fatalf("%s(%s) == %s instead of %s\n", z01.NameOfFunc(fn1), z01.Format(arg1), z01.Format(out2.Results...), diff --git a/tests/go/btreesearchitem_test.go b/tests/go/btreesearchitem_test.go index 3f9836c6..44136127 100644 --- a/tests/go/btreesearchitem_test.go +++ b/tests/go/btreesearchitem_test.go @@ -13,7 +13,7 @@ import ( func errorMessage_search(t *testing.T, fn interface{}, root, a *solutions.TreeNode, b *student.TreeNode, seaVal string) { - t.Errorf("%s(\n%s\n, %s) == %s instead of %s\n", + t.Fatalf("%s(\n%s\n, %s) == %s instead of %s\n", z01.NameOfFunc(fn), solutions.FormatTree(root), seaVal, @@ -30,7 +30,7 @@ func CompareNode_search(t *testing.T, fn interface{}, arg1, a *solutions.TreeNod } if (a == nil && b != nil) || (b == nil && a != nil) { - t.Errorf("Expected %v instead of %v\n", a, b) + t.Fatalf("Expected %v instead of %v\n", a, b) return } @@ -41,31 +41,31 @@ func CompareNode_search(t *testing.T, fn interface{}, arg1, a *solutions.TreeNod if a.Parent != nil && b.Parent != nil { if a.Parent.Data != b.Parent.Data { errorMessage_search(t, fn, arg1, a, b, seaVal) - t.Errorf("Expected parent value %v instead of %v\n", a.Parent.Data, b.Parent.Data) + t.Fatalf("Expected parent value %v instead of %v\n", a.Parent.Data, b.Parent.Data) fmt.Println("Parent.Data", a.Parent.Data, b.Parent.Data) } } else if (a.Parent == nil && b.Parent != nil) || (a.Parent != nil && b.Parent == nil) { - t.Errorf("Expected parent value %v instead of %v\n", a.Parent, b.Parent) + t.Fatalf("Expected parent value %v instead of %v\n", a.Parent, b.Parent) } if a.Right != nil && b.Right != nil { if a.Right.Data != b.Right.Data { errorMessage_search(t, fn, arg1, a, b, seaVal) - t.Errorf("Expected right child value %v instead of %v\n", a.Right.Data, b.Right.Data) + t.Fatalf("Expected right child value %v instead of %v\n", a.Right.Data, b.Right.Data) fmt.Println("Right.Data", a.Right.Data, b.Right.Data) } } else if (a.Right == nil && b.Right != nil) || (a.Right != nil && b.Right == nil) { - t.Errorf("Expected right child value %v instead of %v\n", a.Right, b.Right) + t.Fatalf("Expected right child value %v instead of %v\n", a.Right, b.Right) } if a.Left != nil && b.Left != nil { if a.Left.Data != b.Left.Data { errorMessage_search(t, fn, arg1, a, b, seaVal) - t.Errorf("Expected left child value %v instead of %v\n", a.Left, b.Left) + t.Fatalf("Expected left child value %v instead of %v\n", a.Left, b.Left) fmt.Println("Left.Data", a.Left.Data, b.Left.Data) } } else if (a.Left == nil && b.Left != nil) || (a.Left != nil && b.Left == nil) { - t.Errorf("Expected left child value %v instead of %v\n", a, b) + t.Fatalf("Expected left child value %v instead of %v\n", a, b) } } diff --git a/tests/go/btreetransplant_test.go b/tests/go/btreetransplant_test.go index 7f2b8671..c9cecab6 100644 --- a/tests/go/btreetransplant_test.go +++ b/tests/go/btreetransplant_test.go @@ -84,7 +84,7 @@ func formatSubTree_transp(root *student.TreeNode, prefix string) string { } func errorMessage_transp(t *testing.T, fn interface{}, root, sel, repl *solutions.TreeNode, rootA *solutions.TreeNode, rootAS *student.TreeNode) { - t.Errorf("%s(\nRoot:\n %s, Selected:\n%s, Replacement:\n%s\n) ==\n%s instead of\n%s\n", + t.Fatalf("%s(\nRoot:\n %s, Selected:\n%s, Replacement:\n%s\n) ==\n%s instead of\n%s\n", z01.NameOfFunc(fn), solutions.FormatTree(root), solutions.FormatTree(sel), @@ -106,7 +106,7 @@ func CompareTrees_transp(t *testing.T, fn interface{}, root, sel, repl *solution if parentSol != parentStu { fmt.Println("Tree:\n", solTree) - t.Errorf("Expected\n%s instead of\n%s\n", parentSol, parentStu) + t.Fatalf("Expected\n%s instead of\n%s\n", parentSol, parentStu) } } diff --git a/tests/go/cat_test.go b/tests/go/cat_test.go index b2292123..05192a1e 100644 --- a/tests/go/cat_test.go +++ b/tests/go/cat_test.go @@ -50,7 +50,7 @@ func TestCat(t *testing.T) { pwd, err := os.Getwd() if err != nil { - t.Errorf(err.Error()) + t.Fatalf(err.Error()) } for i := 0; i < 2; i++ { @@ -61,7 +61,7 @@ func TestCat(t *testing.T) { studentResult := execStdin(cmdS, randStdin) if solutionResult != studentResult { - t.Errorf("./cat prints %s instead of %s\n", studentResult, solutionResult) + t.Fatalf("./cat prints %s instead of %s\n", studentResult, solutionResult) } } execC("rm", "cat_student", "cat_solution") diff --git a/tests/go/compact_test.go b/tests/go/compact_test.go index 39092573..1c90959c 100644 --- a/tests/go/compact_test.go +++ b/tests/go/compact_test.go @@ -41,14 +41,14 @@ func TestCompact(t *testing.T) { stu_size := student.Compact(&sli_stu) if !reflect.DeepEqual(sli_stu, sli_sol) { - t.Errorf("Produced slice: %v, instead of %v\n", + t.Fatalf("Produced slice: %v, instead of %v\n", sli_stu, sli_sol, ) } if sol_size != stu_size { - t.Errorf("%s(%v) == %v instead of %v\n", + t.Fatalf("%s(%v) == %v instead of %v\n", "Compact", v, sli_stu, diff --git a/tests/go/createelem_test.go b/tests/go/createelem_test.go index 7e6fb656..4e630046 100644 --- a/tests/go/createelem_test.go +++ b/tests/go/createelem_test.go @@ -44,7 +44,7 @@ func TestCreateElem(t *testing.T) { } if n.Data != n1.Data { - t.Errorf("CreateElem == %d instead of %d\n", n, n1) + t.Fatalf("CreateElem == %d instead of %d\n", n, n1) } } } diff --git a/tests/go/divmod_test.go b/tests/go/divmod_test.go index dbc1bf8f..23887369 100644 --- a/tests/go/divmod_test.go +++ b/tests/go/divmod_test.go @@ -17,10 +17,10 @@ func TestDivMod(t *testing.T) { var mod int student.DivMod(a, b, &div, &mod) if div != a/b { - t.Errorf("DivMod(%d, %d, &div, &mod), div == %d instead of %d", a, b, div, a/b) + t.Fatalf("DivMod(%d, %d, &div, &mod), div == %d instead of %d", a, b, div, a/b) } if mod != a%b { - t.Errorf("DivMod(%d, %d, &div, &mod), mod == %d instead of %d", a, b, mod, a%b) + t.Fatalf("DivMod(%d, %d, &div, &mod), mod == %d instead of %d", a, b, mod, a%b) } i++ } diff --git a/tests/go/enigma_test.go b/tests/go/enigma_test.go index 8c192b53..a285a50f 100644 --- a/tests/go/enigma_test.go +++ b/tests/go/enigma_test.go @@ -45,25 +45,25 @@ func TestEnigma(t *testing.T) { solutions.Decript(a, b, c, d) if aval != ***a { - t.Errorf("Expected ***a = %d instead of %d\n", + t.Fatalf("Expected ***a = %d instead of %d\n", aval, ***a, ) } if bval != *b { - t.Errorf("Expected *b = %d instead of %d\n", + t.Fatalf("Expected *b = %d instead of %d\n", bval, *b, ) } if cval != *******c { - t.Errorf("Expected *******c = %d instead of %d\n", + t.Fatalf("Expected *******c = %d instead of %d\n", cval, *******c, ) } if dval != ****d { - t.Errorf("Expected ****d = %d instead of %d\n", + t.Fatalf("Expected ****d = %d instead of %d\n", dval, ****d, ) diff --git a/tests/go/listat_test.go b/tests/go/listat_test.go index 71deab3a..d502be77 100644 --- a/tests/go/listat_test.go +++ b/tests/go/listat_test.go @@ -42,10 +42,10 @@ func nodePushBackList5(l *Node5, l1 *NodeS5, data interface{}) (*Node5, *NodeS5) func comparFuncNode5(solutionList *NodeS5, l *Node5, l1 *NodeS5, t *testing.T, arg int) { if l == nil && l1 == nil { } else if l != nil && l1 == nil { - t.Errorf("\nListAt(%s, %d) == %v instead of %v\n\n", + t.Fatalf("\nListAt(%s, %d) == %v instead of %v\n\n", solution.ListToString(solutionList), arg, l, l1) } else if l.Data != l1.Data { - t.Errorf("\nListAt(%s, %d) == %v instead of %v\n\n", + t.Fatalf("\nListAt(%s, %d) == %v instead of %v\n\n", solution.ListToString(solutionList), arg, l.Data, l1.Data) } } diff --git a/tests/go/listclear_test.go b/tests/go/listclear_test.go index b0171cd3..39f78d3b 100644 --- a/tests/go/listclear_test.go +++ b/tests/go/listclear_test.go @@ -77,7 +77,7 @@ func TestListClear(t *testing.T) { student.ListClear(link2) if link2.Head != nil { - t.Errorf("\nstudent list:%s\nlist:%s\n\nListClear() == %v instead of %v\n\n", + t.Fatalf("\nstudent list:%s\nlist:%s\n\nListClear() == %v instead of %v\n\n", listToStringStu5(link2), solution.ListToString(link.Head), link2.Head, link.Head) } } diff --git a/tests/go/listfind_test.go b/tests/go/listfind_test.go index a3459621..b3994b75 100644 --- a/tests/go/listfind_test.go +++ b/tests/go/listfind_test.go @@ -58,7 +58,7 @@ func TestListFind(t *testing.T) { if aux != nil || aux1 != nil { if *aux != *aux1 { - t.Errorf("ListFind(ref: %s) == %s instead of %s\n", arg.Data[(len(arg.Data)-1)/2], *aux, *aux1) + t.Fatalf("ListFind(ref: %s) == %s instead of %s\n", arg.Data[(len(arg.Data)-1)/2], *aux, *aux1) } } } @@ -74,7 +74,7 @@ func TestListFind(t *testing.T) { aux1 := solution.ListFind(link, "lksdf", solution.CompStr) if aux != nil && aux1 != nil { if *aux != *aux1 { - t.Errorf("ListFind(ref: lksdf) == %s instead of %s\n", *aux, *aux1) + t.Fatalf("ListFind(ref: lksdf) == %s instead of %s\n", *aux, *aux1) } } diff --git a/tests/go/listforeach_test.go b/tests/go/listforeach_test.go index 1cd46017..bf9f4b41 100644 --- a/tests/go/listforeach_test.go +++ b/tests/go/listforeach_test.go @@ -56,11 +56,11 @@ func comparFuncList7(l *List7, l1 *ListS7, t *testing.T, f func(*Node7)) { funcName := solution.GetName(f) for l.Head != nil || l1.Head != nil { if (l.Head == nil && l1.Head != nil) || (l.Head != nil && l1.Head == nil) { - t.Errorf("\nstudent list: %s\nlist: %s\nfunction used: %s\n\nListForEach() == %v instead of %v\n\n", + t.Fatalf("\nstudent list: %s\nlist: %s\nfunction used: %s\n\nListForEach() == %v instead of %v\n\n", listToStringStu8(l1), solution.ListToString(l.Head), funcName, l1.Head, l.Head) return } else if l.Head.Data != l1.Head.Data { - t.Errorf("\nstudent list: %s\nlist: %s\nfunction used: %s\n\nListForEach() == %v instead of %v\n\n", + t.Fatalf("\nstudent list: %s\nlist: %s\nfunction used: %s\n\nListForEach() == %v instead of %v\n\n", listToStringStu8(l1), solution.ListToString(l.Head), funcName, l1.Head.Data, l.Head.Data) return } diff --git a/tests/go/listforeachif_test.go b/tests/go/listforeachif_test.go index 8e884205..592e329d 100644 --- a/tests/go/listforeachif_test.go +++ b/tests/go/listforeachif_test.go @@ -87,11 +87,11 @@ func comparFuncList8(l *List8, l1 *ListS8, t *testing.T, f func(*Node8) bool, co funcComp := solution.GetName(comp) for l.Head != nil || l1.Head != nil { if (l.Head == nil && l1.Head != nil) || (l.Head != nil && l1.Head == nil) { - t.Errorf("\nstudent list:%s\nlist:%s\nfunction f used: %s\nfunction comp: %s\n\nListForEachIf() == %v instead of %v\n\n", + t.Fatalf("\nstudent list:%s\nlist:%s\nfunction f used: %s\nfunction comp: %s\n\nListForEachIf() == %v instead of %v\n\n", listToStringStu7(l1), solution.ListToString(l.Head), funcComp, funcFName, l1.Head, l.Head) return } else if l.Head.Data != l1.Head.Data { - t.Errorf("\nstudent list:%s\nlist:%s\nfunction f used: %s\nfunction comp: %s\n\nListForEachIf() == %v instead of %v\n\n", + t.Fatalf("\nstudent list:%s\nlist:%s\nfunction f used: %s\nfunction comp: %s\n\nListForEachIf() == %v instead of %v\n\n", listToStringStu7(l1), solution.ListToString(l.Head), funcComp, funcFName, l1.Head.Data, l.Head.Data) return } diff --git a/tests/go/listlast_test.go b/tests/go/listlast_test.go index 83d87eb0..32faf482 100644 --- a/tests/go/listlast_test.go +++ b/tests/go/listlast_test.go @@ -70,7 +70,7 @@ func TestListLast(t *testing.T) { aux1 := student.ListLast(link2) if aux != aux1 { - t.Errorf("\nlist:%s\n\nListLast() == %v instead of %v\n\n", + t.Fatalf("\nlist:%s\n\nListLast() == %v instead of %v\n\n", listToStringStu9(link2), aux1, aux) } link = &List3{} diff --git a/tests/go/listmerge_test.go b/tests/go/listmerge_test.go index e00d4ed6..fda272c7 100644 --- a/tests/go/listmerge_test.go +++ b/tests/go/listmerge_test.go @@ -61,11 +61,11 @@ func listPushBackTest11(l *ListS11, l1 *List11, data interface{}) { func comparFuncList11(l *List11, l1 *ListS11, t *testing.T) { for l.Head != nil || l1.Head != nil { if (l.Head == nil && l1.Head != nil) || (l.Head != nil && l1.Head == nil) { - t.Errorf("\nstudent list:%s\nlist:%s\n\nListMerge() == %v instead of %v\n\n", + t.Fatalf("\nstudent list:%s\nlist:%s\n\nListMerge() == %v instead of %v\n\n", listToStringStu(l1), solution.ListToString(l.Head), l1.Head, l.Head) return } else if l.Head.Data != l1.Head.Data { - t.Errorf("\nstudent list:%s\nlist:%s\n\nListMerge() == %v instead of %v\n\n", + t.Fatalf("\nstudent list:%s\nlist:%s\n\nListMerge() == %v instead of %v\n\n", listToStringStu(l1), solution.ListToString(l.Head), l1.Head.Data, l.Head.Data) return } diff --git a/tests/go/listpushback_test.go b/tests/go/listpushback_test.go index 0da0da4c..e59eefd6 100644 --- a/tests/go/listpushback_test.go +++ b/tests/go/listpushback_test.go @@ -31,11 +31,11 @@ func listToStringStu10(l *List) string { func comparFuncList(l *ListS, l1 *List, t *testing.T, data []interface{}) { for l.Head != nil || l1.Head != nil { if (l.Head == nil && l1.Head != nil) || (l.Head != nil && l1.Head == nil) { - t.Errorf("\ndata used: %v\nstudent list:%s\nlist:%s\n\nListPushBack()== %v instead of %v\n\n", + t.Fatalf("\ndata used: %v\nstudent list:%s\nlist:%s\n\nListPushBack()== %v instead of %v\n\n", data, listToStringStu10(l1), solution.ListToString(l.Head), l1.Head, l.Head) return } else if l.Head.Data != l1.Head.Data { - t.Errorf("\ndata used: %v\nstudent list:%s\nlist:%s\n\nListPushBack()== %v instead of %v\n\n", + t.Fatalf("\ndata used: %v\nstudent list:%s\nlist:%s\n\nListPushBack()== %v instead of %v\n\n", data, listToStringStu10(l1), solution.ListToString(l.Head), l1.Head.Data, l.Head.Data) return } diff --git a/tests/go/listpushfront_test.go b/tests/go/listpushfront_test.go index f8d8665c..9cc32f5f 100644 --- a/tests/go/listpushfront_test.go +++ b/tests/go/listpushfront_test.go @@ -31,11 +31,11 @@ func listToStringStu11(l *Lista) string { func comparFuncList1(l *Lista, l1 *ListSa, t *testing.T, data []interface{}) { for l.Head != nil || l1.Head != nil { if (l.Head == nil && l1.Head != nil) || (l.Head != nil && l1.Head == nil) { - t.Errorf("\ndata used: %v\nstudent list:%s\nlist:%s\n\nListPushFront()== %v instead of %v\n\n", + t.Fatalf("\ndata used: %v\nstudent list:%s\nlist:%s\n\nListPushFront()== %v instead of %v\n\n", data, listToStringStu11(l), solution.ListToString(l1.Head), l.Head, l1.Head) return } else if l.Head.Data != l1.Head.Data { - t.Errorf("\ndata used: %v\nstudent list:%s\nlist:%s\n\nListPushFront()== %v instead of %v\n\n", + t.Fatalf("\ndata used: %v\nstudent list:%s\nlist:%s\n\nListPushFront()== %v instead of %v\n\n", data, listToStringStu11(l), solution.ListToString(l1.Head), l.Head, l1.Head) return } diff --git a/tests/go/listremoveif_test.go b/tests/go/listremoveif_test.go index 47aa7366..1d00d997 100644 --- a/tests/go/listremoveif_test.go +++ b/tests/go/listremoveif_test.go @@ -56,11 +56,11 @@ func listPushBackTest10(l *ListS10, l1 *List10, data interface{}) { func comparFuncList10(l *List10, l1 *ListS10, t *testing.T, data interface{}) { for l.Head != nil || l1.Head != nil { if (l.Head == nil && l1.Head != nil) || (l.Head != nil && l1.Head == nil) { - t.Errorf("\ndata used: %v\nstudent list:%s\nlist:%s\n\nListRemoveIf() == %v instead of %v\n\n", + t.Fatalf("\ndata used: %v\nstudent list:%s\nlist:%s\n\nListRemoveIf() == %v instead of %v\n\n", data, listToStringStu12(l1), solution.ListToString(l.Head), l1.Head, l.Head) return } else if l.Head.Data != l1.Head.Data { - t.Errorf("\ndata used: %v\nstudent list:%s\nlist:%s\n\nListRemoveIf() == %v instead of %v\n\n", + t.Fatalf("\ndata used: %v\nstudent list:%s\nlist:%s\n\nListRemoveIf() == %v instead of %v\n\n", data, listToStringStu12(l1), solution.ListToString(l.Head), l1.Head.Data, l.Head.Data) return } diff --git a/tests/go/listreverse_test.go b/tests/go/listreverse_test.go index 16967ae1..500a8fae 100644 --- a/tests/go/listreverse_test.go +++ b/tests/go/listreverse_test.go @@ -32,11 +32,11 @@ func listToStringStu13(l *ListS6) string { func comparFuncList6(l *List6, l1 *ListS6, t *testing.T) { for l.Head != nil || l1.Head != nil { if (l.Head == nil && l1.Head != nil) || (l.Head != nil && l1.Head == nil) { - t.Errorf("\nstudent list:%s\nlist:%s\n\nListReverse() == %v instead of %v\n\n", + t.Fatalf("\nstudent list:%s\nlist:%s\n\nListReverse() == %v instead of %v\n\n", listToStringStu13(l1), solution.ListToString(l.Head), l1.Head, l.Head) return } else if l.Head.Data != l1.Head.Data { - t.Errorf("\nstudent list:%s\nlist:%s\n\nListReverse() == %v instead of %v\n\n", + t.Fatalf("\nstudent list:%s\nlist:%s\n\nListReverse() == %v instead of %v\n\n", listToStringStu13(l1), solution.ListToString(l.Head), l1.Head.Data, l.Head.Data) return } diff --git a/tests/go/listsize_test.go b/tests/go/listsize_test.go index 1550edda..2cb61226 100644 --- a/tests/go/listsize_test.go +++ b/tests/go/listsize_test.go @@ -54,7 +54,7 @@ func TestListSize(t *testing.T) { aux := solution.ListSize(link) aux2 := student.ListSize(link2) if aux != aux2 { - t.Errorf("ListSize(%v) == %d instead of %d\n", solution.ListToString(link.Head), aux2, aux) + t.Fatalf("ListSize(%v) == %d instead of %d\n", solution.ListToString(link.Head), aux2, aux) } link = &List2{} link2 = &ListS2{} diff --git a/tests/go/listsort_test.go b/tests/go/listsort_test.go index c309e45f..d7b1a678 100644 --- a/tests/go/listsort_test.go +++ b/tests/go/listsort_test.go @@ -51,11 +51,11 @@ func nodePushBackListInt12(l *NodeI12, l1 *NodeIS12, data int) { func comparFuncNodeInt12(l *NodeI12, l1 *NodeIS12, t *testing.T) { for l != nil || l1 != nil { if (l == nil && l1 != nil) || (l != nil && l1 == nil) { - t.Errorf("\nstudent list:%s\nlist:%s\n\nListSort() == %v instead of %v\n\n", + t.Fatalf("\nstudent list:%s\nlist:%s\n\nListSort() == %v instead of %v\n\n", printListStudent(l), solution.PrintList(l1), l, l1) return } else if l.Data != l1.Data { - t.Errorf("\nstudent list:%s\nlist:%s\n\nListSort() == %v instead of %v\n\n", + t.Fatalf("\nstudent list:%s\nlist:%s\n\nListSort() == %v instead of %v\n\n", printListStudent(l), solution.PrintList(l1), l.Data, l1.Data) return } diff --git a/tests/go/pointone_test.go b/tests/go/pointone_test.go index 25f6800a..4a34a059 100644 --- a/tests/go/pointone_test.go +++ b/tests/go/pointone_test.go @@ -10,6 +10,6 @@ func TestPointOne(t *testing.T) { n := 0 student.PointOne(&n) if n != 1 { - t.Errorf("PointOne(&n), n == %d instead of 1", n) + t.Fatalf("PointOne(&n), n == %d instead of 1", n) } } diff --git a/tests/go/printprogramname_test.go b/tests/go/printprogramname_test.go index 92ba1494..28bfd4ad 100644 --- a/tests/go/printprogramname_test.go +++ b/tests/go/printprogramname_test.go @@ -12,19 +12,19 @@ func TestPrintProgramName(t *testing.T) { strings.TrimPrefix(t.Name(), "Test")) out, err1 := z01.MainOut("./student/printprogramname") if err1 != nil { - t.Errorf(err1.Error()) + t.Fatalf(err1.Error()) } correct, err2 := z01.MainOut("./solutions/printprogramname") if err2 != nil { - t.Errorf(err2.Error()) + t.Fatalf(err2.Error()) } arrOut := strings.Split(out, "/") ArrCor := strings.Split(correct, "/") if ArrCor[len(ArrCor)-1] != arrOut[len(arrOut)-1] { - t.Errorf("./%s prints %q instead of %q\n", + t.Fatalf("./%s prints %q instead of %q\n", exercise, arrOut[len(arrOut)-1], ArrCor[len(ArrCor)-1]) } } diff --git a/tests/go/solutions/addlinkednumbers/addlinkednumbers_test.go b/tests/go/solutions/addlinkednumbers/addlinkednumbers_test.go index f7c6e643..94a7794f 100644 --- a/tests/go/solutions/addlinkednumbers/addlinkednumbers_test.go +++ b/tests/go/solutions/addlinkednumbers/addlinkednumbers_test.go @@ -87,17 +87,17 @@ func compareNodes(t *testing.T, stuResult *stuNode, solResult *solNode, num1, nu } else if stuResult != nil && solResult == nil { stuNum := stuNodeString(stuResult) - t.Errorf("\nAddLinkedNumbers(%v, %v) == %v instead of %v\n\n", + t.Fatalf("\nAddLinkedNumbers(%v, %v) == %v instead of %v\n\n", num1, num2, stuNum, "") } else if stuResult == nil && solResult != nil { solNum := solNodeString(solResult) - t.Errorf("\nAddLinkedNumbers(%v, %v) == %v instead of %v\n\n", + t.Fatalf("\nAddLinkedNumbers(%v, %v) == %v instead of %v\n\n", num1, num2, "", solNum) } else { stuNum := stuNodeString(stuResult) solNum := solNodeString(solResult) if stuNum != solNum { - t.Errorf("\nAddLinkedNumbers(%v, %v) == %v instead of %v\n\n", + t.Fatalf("\nAddLinkedNumbers(%v, %v) == %v instead of %v\n\n", num1, num2, stuNum, solNum) } } diff --git a/tests/go/solutions/challenge.go b/tests/go/solutions/challenge.go index 87d75beb..5120f23d 100644 --- a/tests/go/solutions/challenge.go +++ b/tests/go/solutions/challenge.go @@ -100,7 +100,7 @@ func ChallengeTree(t *testing.T, st2 := z01.Monitor(fn2, args2) if st1.Stdout != st2.Stdout { - t.Errorf("%s(\n%s)\n prints %s instead of %s\n", + t.Fatalf("%s(\n%s)\n prints %s instead of %s\n", z01.NameOfFunc(fn2), FormatTree(arg1), z01.Format(st2.Stdout), @@ -124,7 +124,7 @@ func Challenge(t *testing.T, fn1, fn2 interface{}, arg1, arg2 interface{}, args st2 := z01.Monitor(fn2, args2) if st1.Stdout != st2.Stdout { - t.Errorf("%s(%s) prints %s instead of %s\n", + t.Fatalf("%s(%s) prints %s instead of %s\n", z01.NameOfFunc(fn2), z01.Format(arg2), z01.Format(st2.Stdout), diff --git a/tests/go/solutions/changeorder/changeorder_test.go b/tests/go/solutions/changeorder/changeorder_test.go index e1d61a4a..ebd7c743 100644 --- a/tests/go/solutions/changeorder/changeorder_test.go +++ b/tests/go/solutions/changeorder/changeorder_test.go @@ -76,17 +76,17 @@ func compareNodes(t *testing.T, stuResult *stuNode, solResult *solNode, num1 int if stuResult == nil && solResult == nil { } else if stuResult != nil && solResult == nil { stuNum := stuListToNum(stuResult) - t.Errorf("\nChangeorder(%s) == %v instead of %v\n\n", + t.Fatalf("\nChangeorder(%s) == %v instead of %v\n\n", solList, stuNum, "") } else if stuResult == nil && solResult != nil { solNum := solListToNum(solResult) - t.Errorf("\nChangeorder(%s) == %v instead of %v\n\n", + t.Fatalf("\nChangeorder(%s) == %v instead of %v\n\n", solList, "", solNum) } else { stuNum := stuListToNum(stuResult) solNum := solListToNum(solResult) if stuNum != solNum { - t.Errorf("\nChangeorder(%s) == %v instead of %v\n\n", + t.Fatalf("\nChangeorder(%s) == %v instead of %v\n\n", solList, stuNum, solNum) } } diff --git a/tests/go/solutions/checkfile.go b/tests/go/solutions/checkfile.go index ab5b79a0..8b40afff 100644 --- a/tests/go/solutions/checkfile.go +++ b/tests/go/solutions/checkfile.go @@ -10,6 +10,6 @@ func CheckFile(t *testing.T, path string) { _, err := os.Stat(path) if err != nil { - t.Errorf(err.Error()) + t.Fatalf(err.Error()) } } diff --git a/tests/go/solutions/comparenode.go b/tests/go/solutions/comparenode.go index 6e587ded..6b98ce7e 100644 --- a/tests/go/solutions/comparenode.go +++ b/tests/go/solutions/comparenode.go @@ -11,7 +11,7 @@ import ( func CompareNode(t *testing.T, a *solutions.TreeNode, b *student.TreeNode) { if a != nil && b != nil { if a.Data != b.Data { - t.Errorf("expected %s instead of %s\n", + t.Fatalf("expected %s instead of %s\n", a.Data, b.Data, ) @@ -20,12 +20,12 @@ func CompareNode(t *testing.T, a *solutions.TreeNode, b *student.TreeNode) { CompareNode(t, a.Right, b.Right) } } else if a != nil && b == nil { - t.Errorf("expected %s instead of %v\n", + t.Fatalf("expected %s instead of %v\n", a.Data, b, ) } else if a == nil && b != nil { - t.Errorf("expected %v instead of %v\n", + t.Fatalf("expected %v instead of %v\n", a, b.Data, ) diff --git a/tests/go/solutions/comparereturn.go b/tests/go/solutions/comparereturn.go index cc9c7b69..8b01e2ef 100644 --- a/tests/go/solutions/comparereturn.go +++ b/tests/go/solutions/comparereturn.go @@ -24,7 +24,7 @@ func CompareReturn(t *testing.T, fn1, fn2, arg1, arg2 interface{}) { CompareNode(t, str, out2.Results[i].(*student.TreeNode)) default: if !reflect.DeepEqual(str, out2.Results[i]) { - t.Errorf("%s(%s) == %s instead of %s\n", + t.Fatalf("%s(%s) == %s instead of %s\n", z01.NameOfFunc(fn1), z01.Format(arg1), z01.Format(out1.Results...), diff --git a/tests/go/solutions/comparetrees.go b/tests/go/solutions/comparetrees.go index 94a5605a..006ae503 100644 --- a/tests/go/solutions/comparetrees.go +++ b/tests/go/solutions/comparetrees.go @@ -13,12 +13,12 @@ func CompareTrees(root *solutions.TreeNode, rootS *student.TreeNode, t *testing. CompareTrees(root.Left, rootS.Left, t) CompareTrees(root.Right, rootS.Right, t) if root.Data != rootS.Data { - t.Errorf("BTreeInsertData(%v), node == %v instead of %v ", + t.Fatalf("BTreeInsertData(%v), node == %v instead of %v ", root.Data, root.Data, rootS.Data) } } else if root != nil && rootS == nil { - t.Errorf("BTreeInsertData(%v), node == %v instead of %v ", root, root, rootS) + t.Fatalf("BTreeInsertData(%v), node == %v instead of %v ", root, root, rootS) } else if root == nil && rootS != nil { - t.Errorf("BTreeInsertData(%v), node == %v instead of %v ", root, root, rootS) + t.Fatalf("BTreeInsertData(%v), node == %v instead of %v ", root, root, rootS) } } diff --git a/tests/go/solutions/inverttree/inverttree_test.go b/tests/go/solutions/inverttree/inverttree_test.go index d6317afc..c4305620 100644 --- a/tests/go/solutions/inverttree/inverttree_test.go +++ b/tests/go/solutions/inverttree/inverttree_test.go @@ -160,8 +160,8 @@ func TestInvertTree(t *testing.T) { if ret != 1 { tree1 := returnSolTree(temp) tree2 := returnStuTree(tmp) - t.Errorf("\n\"%v\" instead of \"%v\"\n\n", tree1, tree2) - // t.Errorf("\nError\n\n") + t.Fatalf("\n\"%v\" instead of \"%v\"\n\n", tree1, tree2) + // t.Fatalf("\nError\n\n") } } } diff --git a/tests/go/solutions/listremoveifprog/listremoveifprog_test.go b/tests/go/solutions/listremoveifprog/listremoveifprog_test.go index d0712589..5368186d 100644 --- a/tests/go/solutions/listremoveifprog/listremoveifprog_test.go +++ b/tests/go/solutions/listremoveifprog/listremoveifprog_test.go @@ -55,11 +55,11 @@ func listPushBackTest10(l *ListS10, l1 *List10, data interface{}) { func comparFuncList10(l *List10, l1 *ListS10, t *testing.T, data interface{}) { for l.Head != nil || l1.Head != nil { if (l.Head == nil && l1.Head != nil) || (l.Head != nil && l1.Head == nil) { - t.Errorf("\ndata used: %v\nstudent list:%s\nlist:%s\n\nListRemoveIf() == %v instead of %v\n\n", + t.Fatalf("\ndata used: %v\nstudent list:%s\nlist:%s\n\nListRemoveIf() == %v instead of %v\n\n", data, listToStringStu12(l1), solution.ListToString(l.Head), l1.Head, l.Head) return } else if l.Head.Data != l1.Head.Data { - t.Errorf("\ndata used: %v\nstudent list:%s\nlist:%s\n\nListRemoveIf() == %v instead of %v\n\n", + t.Fatalf("\ndata used: %v\nstudent list:%s\nlist:%s\n\nListRemoveIf() == %v instead of %v\n\n", data, listToStringStu12(l1), solution.ListToString(l.Head), l1.Head.Data, l.Head.Data) return } diff --git a/tests/go/solutions/listsizeprog/listsizeprog_test.go b/tests/go/solutions/listsizeprog/listsizeprog_test.go index ed03837c..24f5a6b8 100644 --- a/tests/go/solutions/listsizeprog/listsizeprog_test.go +++ b/tests/go/solutions/listsizeprog/listsizeprog_test.go @@ -53,7 +53,7 @@ func TestListSizeProg(t *testing.T) { aux := solution.ListSize(link) aux2 := ListSize(link2) if aux != aux2 { - t.Errorf("ListSize(%v) == %d instead of %d\n", solution.ListToString(link.Head), aux2, aux) + t.Fatalf("ListSize(%v) == %d instead of %d\n", solution.ListToString(link.Head), aux2, aux) } link = &List2{} link2 = &ListS2{} diff --git a/tests/go/solutions/merge/merge_test.go b/tests/go/solutions/merge/merge_test.go index 2e4887d0..20457043 100644 --- a/tests/go/solutions/merge/merge_test.go +++ b/tests/go/solutions/merge/merge_test.go @@ -147,7 +147,7 @@ func compareTrees(t *testing.T, stuResult *stuTreeNode, solResult, solTree1, sol tree2 := returnSolTree(solTree2) stuTree := returnStuTree(stuResult) solTree := returnSolTree(solResult) - t.Errorf("\nMergeTrees(\"%v\", \"%v\") == \"%v\" instead of \"%v\"\n\n", tree1, tree2, stuTree, solTree) + t.Fatalf("\nMergeTrees(\"%v\", \"%v\") == \"%v\" instead of \"%v\"\n\n", tree1, tree2, stuTree, solTree) } } diff --git a/tests/go/solutions/reverse/reverse_test.go b/tests/go/solutions/reverse/reverse_test.go index 0404b261..17e0bc7f 100644 --- a/tests/go/solutions/reverse/reverse_test.go +++ b/tests/go/solutions/reverse/reverse_test.go @@ -64,17 +64,17 @@ func compareNodes(t *testing.T, stuResult *stuNode, solResult *solNode, num1 int } else if stuResult != nil && solResult == nil { stuNum := stuListToNum(stuResult) - t.Errorf("\nReverse(%d) == %v instead of %v\n\n", + t.Fatalf("\nReverse(%d) == %v instead of %v\n\n", num1, stuNum, "") } else if stuResult == nil && solResult != nil { solNum := solListToNum(solResult) - t.Errorf("\nReverse(%d) == %v instead of %v\n\n", + t.Fatalf("\nReverse(%d) == %v instead of %v\n\n", num1, "", solNum) } else { stuNum := stuListToNum(stuResult) solNum := solListToNum(solResult) if stuNum != solNum { - t.Errorf("\nReverse(%d) == %v instead of %v\n\n", + t.Fatalf("\nReverse(%d) == %v instead of %v\n\n", num1, stuNum, solNum) } } diff --git a/tests/go/solutions/reversebits/reversebits_test.go b/tests/go/solutions/reversebits/reversebits_test.go index e10083db..2da02841 100644 --- a/tests/go/solutions/reversebits/reversebits_test.go +++ b/tests/go/solutions/reversebits/reversebits_test.go @@ -14,7 +14,7 @@ func challengeBytes(t *testing.T, st1 := z01.Monitor(fn1, args) st2 := z01.Monitor(fn2, args) if !reflect.DeepEqual(st1.Results, st2.Results) { - t.Errorf("%s(%08b) == %08b instead of %08b\n", + t.Fatalf("%s(%08b) == %08b instead of %08b\n", z01.NameOfFunc(fn1), args[0].(byte), st1.Results[0].(byte), diff --git a/tests/go/solutions/sametree/sametree_test.go b/tests/go/solutions/sametree/sametree_test.go index ffb28c97..cf87323e 100644 --- a/tests/go/solutions/sametree/sametree_test.go +++ b/tests/go/solutions/sametree/sametree_test.go @@ -86,7 +86,7 @@ func compareResults(t *testing.T, stuResult, solResult bool, solTree1, solTree2 if stuResult != solResult { tree1 := returnSolTree(solTree1) tree2 := returnSolTree(solTree2) - t.Errorf("\nIsSameTree(\"%v\", \"%v\") == \"%v\" instead of \"%v\"\n\n", tree1, tree2, stuResult, solResult) + t.Fatalf("\nIsSameTree(\"%v\", \"%v\") == \"%v\" instead of \"%v\"\n\n", tree1, tree2, stuResult, solResult) } } diff --git a/tests/go/solutions/sortll/sortll_test.go b/tests/go/solutions/sortll/sortll_test.go index 4079ffcb..2800d470 100644 --- a/tests/go/solutions/sortll/sortll_test.go +++ b/tests/go/solutions/sortll/sortll_test.go @@ -64,17 +64,17 @@ func compareNodes(t *testing.T, stuResult *stuNode, solResult *solNode, num1 int } else if stuResult != nil && solResult == nil { stuNum := stuListToNum(stuResult) - t.Errorf("\nSortll(%d) == %v instead of %v\n\n", + t.Fatalf("\nSortll(%d) == %v instead of %v\n\n", num1, stuNum, "") } else if stuResult == nil && solResult != nil { solNum := solListToNum(solResult) - t.Errorf("\nSortll(%d) == %v instead of %v\n\n", + t.Fatalf("\nSortll(%d) == %v instead of %v\n\n", num1, "", solNum) } else { stuNum := stuListToNum(stuResult) solNum := solListToNum(solResult) if stuNum != solNum { - t.Errorf("\nSortll(%d) == %v instead of %v\n\n", + t.Fatalf("\nSortll(%d) == %v instead of %v\n\n", num1, stuNum, solNum) } } diff --git a/tests/go/solutions/sortwordarrprog/sortwordarrprog_test.go b/tests/go/solutions/sortwordarrprog/sortwordarrprog_test.go index 27f472be..51634beb 100644 --- a/tests/go/solutions/sortwordarrprog/sortwordarrprog_test.go +++ b/tests/go/solutions/sortwordarrprog/sortwordarrprog_test.go @@ -31,7 +31,7 @@ func TestSortWordArrProg(t *testing.T) { SortWordArr(cp_stu) if !reflect.DeepEqual(cp_stu, cp_sol) { - t.Errorf("%s(%v) == %v instead of %v\n", + t.Fatalf("%s(%v) == %v instead of %v\n", "SortWordArr", org, cp_stu, diff --git a/tests/go/solutions/swapbits/swapbits_test.go b/tests/go/solutions/swapbits/swapbits_test.go index 819ca6cf..a41655e9 100644 --- a/tests/go/solutions/swapbits/swapbits_test.go +++ b/tests/go/solutions/swapbits/swapbits_test.go @@ -13,7 +13,7 @@ func challengeBytes(t *testing.T, fn1, fn2 interface{}, args ...interface{}) { st1 := z01.Monitor(fn1, args) st2 := z01.Monitor(fn2, args) if !reflect.DeepEqual(st1.Results, st2.Results) { - t.Errorf("%s(%08b) == %08b instead of %08b\n", + t.Fatalf("%s(%08b) == %08b instead of %08b\n", z01.NameOfFunc(fn1), args[0].(byte), st1.Results[0].(byte), diff --git a/tests/go/solutions/swapprog/swapprog_test.go b/tests/go/solutions/swapprog/swapprog_test.go index c9da1fa0..477256e8 100644 --- a/tests/go/solutions/swapprog/swapprog_test.go +++ b/tests/go/solutions/swapprog/swapprog_test.go @@ -15,10 +15,10 @@ func TestSwapProg(t *testing.T) { bCopy := b Swap(&a, &b) if a != bCopy { - t.Errorf("Swap(%d, %d), a == %d instead of %d", aCopy, bCopy, a, bCopy) + t.Fatalf("Swap(%d, %d), a == %d instead of %d", aCopy, bCopy, a, bCopy) } if b != aCopy { - t.Errorf("Swap(%d, %d), b == %d instead of %d", aCopy, bCopy, b, aCopy) + t.Fatalf("Swap(%d, %d), b == %d instead of %d", aCopy, bCopy, b, aCopy) } i++ } diff --git a/tests/go/sortedlistmerge_test.go b/tests/go/sortedlistmerge_test.go index e0610e65..e0930dad 100644 --- a/tests/go/sortedlistmerge_test.go +++ b/tests/go/sortedlistmerge_test.go @@ -97,10 +97,10 @@ func TestSortedListMerge(t *testing.T) { if aux == nil && aux2 == nil { } else if aux != nil && aux2 == nil { - t.Errorf("\nstudent merged lists:%s\nmerged lists:%s\n\nSortListMerge() == %v instead of %v\n\n", + t.Fatalf("\nstudent merged lists:%s\nmerged lists:%s\n\nSortListMerge() == %v instead of %v\n\n", printListStudent1(aux), solution.PrintList(aux2), aux, aux2) } else if aux.Data != aux2.Data { - t.Errorf("\nstudent merged lists:%s\nmerged lists:%s\n\nSortListMerge() == %v instead of %v\n\n", + t.Fatalf("\nstudent merged lists:%s\nmerged lists:%s\n\nSortListMerge() == %v instead of %v\n\n", printListStudent1(aux), solution.PrintList(aux2), aux, aux2) } diff --git a/tests/go/sortintegertable_test.go b/tests/go/sortintegertable_test.go index 47212920..6a3730f6 100644 --- a/tests/go/sortintegertable_test.go +++ b/tests/go/sortintegertable_test.go @@ -24,7 +24,7 @@ func TestSortIntegerTable(t *testing.T) { student.SortIntegerTable(table) solutions.SortIntegerTable(table2) if !reflect.DeepEqual(table, table2) { - t.Errorf("SortIntegerTable(%v), table == %v instead of %v ", tableCopyBefore, table, table2) + t.Fatalf("SortIntegerTable(%v), table == %v instead of %v ", tableCopyBefore, table, table2) } i++ } diff --git a/tests/go/sortlist_test.go b/tests/go/sortlist_test.go index 5c32e184..70a683ea 100644 --- a/tests/go/sortlist_test.go +++ b/tests/go/sortlist_test.go @@ -74,7 +74,7 @@ func compare(t *testing.T, l *solution.Nodelist, l1 *student.Nodelist, f func(a, for l1 != nil && l != nil { if l1.Data != l.Data { - t.Errorf("\nstudent list:%s\nlist:%s\nfunction cmp:%s\n\nSortListInsert() == %v instead of %v\n\n", + t.Fatalf("\nstudent list:%s\nlist:%s\nfunction cmp:%s\n\nSortListInsert() == %v instead of %v\n\n", listToStringStu4(l1), listToString4(l), cmp, l1.Data, l.Data) return } diff --git a/tests/go/sortlistinsert_test.go b/tests/go/sortlistinsert_test.go index 2179e088..c2a7c7fb 100644 --- a/tests/go/sortlistinsert_test.go +++ b/tests/go/sortlistinsert_test.go @@ -55,11 +55,11 @@ func nodepushback2(l *NodeIS14, data int) *NodeIS14 { func comparFuncNodeInt14(l *NodeI14, l1 *NodeIS14, t *testing.T, data []int) { for l != nil || l1 != nil { if (l == nil && l1 != nil) || (l != nil && l1 == nil) { - t.Errorf("\ndata used to insert: %d\nstudent list:%s\nlist:%s\n\nSortListInsert() == %v instead of %v\n\n", + t.Fatalf("\ndata used to insert: %d\nstudent list:%s\nlist:%s\n\nSortListInsert() == %v instead of %v\n\n", data, listToStringStu3(l), solution.PrintList(l1), l, l1) return } else if l.Data != l1.Data { - t.Errorf("\ndata used to insert: %d\nstudent list:%s\nlist:%s\n\nSortListInsert() == %v instead of %v\n\n", + t.Fatalf("\ndata used to insert: %d\nstudent list:%s\nlist:%s\n\nSortListInsert() == %v instead of %v\n\n", data, listToStringStu3(l), solution.PrintList(l1), l.Data, l1.Data) return } diff --git a/tests/go/sortwordarr_test.go b/tests/go/sortwordarr_test.go index 95012152..eeee4dc9 100644 --- a/tests/go/sortwordarr_test.go +++ b/tests/go/sortwordarr_test.go @@ -32,7 +32,7 @@ func TestSortWordArr(t *testing.T) { student.SortWordArr(cp_stu) if !reflect.DeepEqual(cp_stu, cp_sol) { - t.Errorf("%s(%v) == %v instead of %v\n", + t.Fatalf("%s(%v) == %v instead of %v\n", "SortWordArr", org, cp_stu, diff --git a/tests/go/swap_test.go b/tests/go/swap_test.go index b061f684..7f2dfb45 100644 --- a/tests/go/swap_test.go +++ b/tests/go/swap_test.go @@ -17,10 +17,10 @@ func TestSwap(t *testing.T) { bCopy := b student.Swap(&a, &b) if a != bCopy { - t.Errorf("Swap(%d, %d), a == %d instead of %d", aCopy, bCopy, a, bCopy) + t.Fatalf("Swap(%d, %d), a == %d instead of %d", aCopy, bCopy, a, bCopy) } if b != aCopy { - t.Errorf("Swap(%d, %d), b == %d instead of %d", aCopy, bCopy, b, aCopy) + t.Fatalf("Swap(%d, %d), b == %d instead of %d", aCopy, bCopy, b, aCopy) } i++ } diff --git a/tests/go/swapbits_test.go b/tests/go/swapbits_test.go index 821b02c7..73ea392a 100644 --- a/tests/go/swapbits_test.go +++ b/tests/go/swapbits_test.go @@ -14,7 +14,7 @@ func challengeBytes(t *testing.T, fn1, fn2 interface{}, args ...interface{}) { st1 := z01.Monitor(fn1, args) st2 := z01.Monitor(fn2, args) if !reflect.DeepEqual(st1.Results, st2.Results) { - t.Errorf("%s(%08b) == %08b instead of %08b\n", + t.Fatalf("%s(%08b) == %08b instead of %08b\n", z01.NameOfFunc(fn1), args[0].(byte), st1.Results[0].(byte), diff --git a/tests/go/ultimatedivmod_test.go b/tests/go/ultimatedivmod_test.go index b67667d1..458de721 100644 --- a/tests/go/ultimatedivmod_test.go +++ b/tests/go/ultimatedivmod_test.go @@ -18,10 +18,10 @@ func TestUltimateDivMod(t *testing.T) { mod := a % b student.UltimateDivMod(&a, &b) if a != div { - t.Errorf("DivMod(%d, %d), a == %d instead of %d", aCopy, bCopy, a, div) + t.Fatalf("DivMod(%d, %d), a == %d instead of %d", aCopy, bCopy, a, div) } if b != mod { - t.Errorf("DivMod(%d, %d), b == %d instead of %d", aCopy, bCopy, b, mod) + t.Fatalf("DivMod(%d, %d), b == %d instead of %d", aCopy, bCopy, b, mod) } i++ } diff --git a/tests/go/ultimatepointone_test.go b/tests/go/ultimatepointone_test.go index bdb1c941..250c1f04 100644 --- a/tests/go/ultimatepointone_test.go +++ b/tests/go/ultimatepointone_test.go @@ -12,6 +12,6 @@ func TestUltimatePointOne(t *testing.T) { n := &b student.UltimatePointOne(&n) if a != 1 { - t.Errorf("UltimatePointOne(&n), a == %d instead of 1", a) + t.Fatalf("UltimatePointOne(&n), a == %d instead of 1", a) } }