Browse Source

Use Fatal instead of Error (to make the tests abort faster)

content-update
Xavier Petit 4 years ago committed by xpetit
parent
commit
ad01969b09
  1. 2
      tests/go/advancedsortwordarr_test.go
  2. 2
      tests/go/btreedeletenode_test.go
  3. 2
      tests/go/btreeinsertdata_test.go
  4. 18
      tests/go/btreeisbinary_test.go
  5. 18
      tests/go/btreelevelcount_test.go
  6. 18
      tests/go/btreemax_test.go
  7. 18
      tests/go/btreemin_test.go
  8. 6
      tests/go/btreerotateleft_test.go
  9. 6
      tests/go/btreerotateright_test.go
  10. 16
      tests/go/btreesearchitem_test.go
  11. 4
      tests/go/btreetransplant_test.go
  12. 4
      tests/go/cat_test.go
  13. 4
      tests/go/compact_test.go
  14. 2
      tests/go/createelem_test.go
  15. 4
      tests/go/divmod_test.go
  16. 8
      tests/go/enigma_test.go
  17. 4
      tests/go/listat_test.go
  18. 2
      tests/go/listclear_test.go
  19. 4
      tests/go/listfind_test.go
  20. 4
      tests/go/listforeach_test.go
  21. 4
      tests/go/listforeachif_test.go
  22. 2
      tests/go/listlast_test.go
  23. 4
      tests/go/listmerge_test.go
  24. 4
      tests/go/listpushback_test.go
  25. 4
      tests/go/listpushfront_test.go
  26. 4
      tests/go/listremoveif_test.go
  27. 4
      tests/go/listreverse_test.go
  28. 2
      tests/go/listsize_test.go
  29. 4
      tests/go/listsort_test.go
  30. 2
      tests/go/pointone_test.go
  31. 6
      tests/go/printprogramname_test.go
  32. 6
      tests/go/solutions/addlinkednumbers/addlinkednumbers_test.go
  33. 4
      tests/go/solutions/challenge.go
  34. 6
      tests/go/solutions/changeorder/changeorder_test.go
  35. 2
      tests/go/solutions/checkfile.go
  36. 6
      tests/go/solutions/comparenode.go
  37. 2
      tests/go/solutions/comparereturn.go
  38. 6
      tests/go/solutions/comparetrees.go
  39. 4
      tests/go/solutions/inverttree/inverttree_test.go
  40. 4
      tests/go/solutions/listremoveifprog/listremoveifprog_test.go
  41. 2
      tests/go/solutions/listsizeprog/listsizeprog_test.go
  42. 2
      tests/go/solutions/merge/merge_test.go
  43. 6
      tests/go/solutions/reverse/reverse_test.go
  44. 2
      tests/go/solutions/reversebits/reversebits_test.go
  45. 2
      tests/go/solutions/sametree/sametree_test.go
  46. 6
      tests/go/solutions/sortll/sortll_test.go
  47. 2
      tests/go/solutions/sortwordarrprog/sortwordarrprog_test.go
  48. 2
      tests/go/solutions/swapbits/swapbits_test.go
  49. 4
      tests/go/solutions/swapprog/swapprog_test.go
  50. 4
      tests/go/sortedlistmerge_test.go
  51. 2
      tests/go/sortintegertable_test.go
  52. 2
      tests/go/sortlist_test.go
  53. 4
      tests/go/sortlistinsert_test.go
  54. 2
      tests/go/sortwordarr_test.go
  55. 4
      tests/go/swap_test.go
  56. 2
      tests/go/swapbits_test.go
  57. 4
      tests/go/ultimatedivmod_test.go
  58. 2
      tests/go/ultimatepointone_test.go

2
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,

2
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,

2
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,

18
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...),

18
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...),

18
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...),

18
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...),

6
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...),

6
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...),

16
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)
}
}

4
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)
}
}

4
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")

4
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,

2
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)
}
}
}

4
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++
}

8
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,
)

4
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)
}
}

2
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)
}
}

4
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)
}
}

4
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
}

4
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
}

2
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{}

4
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
}

4
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
}

4
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
}

4
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
}

4
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
}

2
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{}

4
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
}

2
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)
}
}

6
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])
}
}

6
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)
}
}

4
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),

6
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)
}
}

2
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())
}
}

6
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,
)

2
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...),

6
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)
}
}

4
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")
}
}
}

4
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
}

2
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{}

2
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)
}
}

6
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)
}
}

2
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),

2
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)
}
}

6
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)
}
}

2
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,

2
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),

4
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++
}

4
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)
}

2
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++
}

2
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
}

4
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
}

2
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,

4
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++
}

2
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),

4
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++
}

2
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)
}
}

Loading…
Cancel
Save