@@ -30,16 +30,14 @@ func TestAlgorithms(t *testing.T) {
3030
3131 // now the verification
3232 result , ok := Add8 (a8 , b8 )
33- if ok {
34- if int64 (result ) != r64 {
35- t .Errorf ("failed to fail on %v + %v = %v instead of %v\n " , a8 , b8 , result , r64 )
36- errors ++
37- }
38- } else {
39- if int64 (result ) == r64 {
40- t .Fail ()
41- errors ++
42- }
33+ if ok && int64 (result ) != r64 {
34+ t .Errorf ("failed to fail on %v + %v = %v instead of %v\n " ,
35+ a8 , b8 , result , r64 )
36+ errors ++
37+ }
38+ if ! ok && int64 (result ) == r64 {
39+ t .Fail ()
40+ errors ++
4341 }
4442 }
4543
@@ -49,15 +47,13 @@ func TestAlgorithms(t *testing.T) {
4947
5048 // now the verification
5149 result , ok := Sub8 (a8 , b8 )
52- if ok {
53- if int64 (result ) != r64 {
54- t .Errorf ("failed to fail on %v - %v = %v instead of %v\n " , a8 , b8 , result , r64 )
55- }
56- } else {
57- if int64 (result ) == r64 {
58- t .Fail ()
59- errors ++
60- }
50+ if ok && int64 (result ) != r64 {
51+ t .Errorf ("failed to fail on %v - %v = %v instead of %v\n " ,
52+ a8 , b8 , result , r64 )
53+ }
54+ if ! ok && int64 (result ) == r64 {
55+ t .Fail ()
56+ errors ++
6157 }
6258 }
6359
@@ -67,16 +63,14 @@ func TestAlgorithms(t *testing.T) {
6763
6864 // now the verification
6965 result , ok := Mul8 (a8 , b8 )
70- if ok {
71- if int64 (result ) != r64 {
72- t .Errorf ("failed to fail on %v * %v = %v instead of %v\n " , a8 , b8 , result , r64 )
73- errors ++
74- }
75- } else {
76- if int64 (result ) == r64 {
77- t .Fail ()
78- errors ++
79- }
66+ if ok && int64 (result ) != r64 {
67+ t .Errorf ("failed to fail on %v * %v = %v instead of %v\n " ,
68+ a8 , b8 , result , r64 )
69+ errors ++
70+ }
71+ if ! ok && int64 (result ) == r64 {
72+ t .Fail ()
73+ errors ++
8074 }
8175 }
8276
@@ -86,16 +80,14 @@ func TestAlgorithms(t *testing.T) {
8680
8781 // now the verification
8882 result , _ , ok := Quotient8 (a8 , b8 )
89- if ok {
90- if int64 (result ) != r64 {
91- t .Errorf ("failed to fail on %v / %v = %v instead of %v\n " , a8 , b8 , result , r64 )
92- errors ++
93- }
94- } else {
95- if result != 0 && int64 (result ) == r64 {
96- t .Fail ()
97- errors ++
98- }
83+ if ok && int64 (result ) != r64 {
84+ t .Errorf ("failed to fail on %v / %v = %v instead of %v\n " ,
85+ a8 , b8 , result , r64 )
86+ errors ++
87+ }
88+ if ! ok && result != 0 && int64 (result ) == r64 {
89+ t .Fail ()
90+ errors ++
9991 }
10092 }
10193 }
0 commit comments