-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
26e4e8e
commit 495acb7
Showing
3 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package calc | ||
|
||
import ( | ||
"testing" | ||
) | ||
|
||
func TestAbs(t *testing.T) { | ||
if Abs(-1) != 1 || Abs(1) != 1 { | ||
t.Errorf("abs doesn't work") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package calc | ||
|
||
import "testing" | ||
|
||
func TestMax(t *testing.T) { | ||
if Max(1_000_000, 2) != 1_000_000 { | ||
t.Errorf("max doesn't work") | ||
} | ||
if Max(-1, 1_000_000) != 1_000_000 { | ||
t.Errorf("max doesn't work") | ||
} | ||
} | ||
|
||
func TestMax64(t *testing.T) { | ||
if Max64(1_000_000_000_000, 2) != 1_000_000_000_000 { | ||
t.Errorf("max64 doesn't work") | ||
} | ||
if Max64(-1, 1_000_000_000_000) != 1_000_000_000_000 { | ||
t.Errorf("max64 doesn't work") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package calc | ||
|
||
import "testing" | ||
|
||
func TestMin(t *testing.T) { | ||
if Min(1_000_000, 2) != 2 { | ||
t.Errorf("Min doesn't work") | ||
} | ||
if Min(-1, 1_000_000) != -1 { | ||
t.Errorf("Min doesn't work") | ||
} | ||
} | ||
|
||
func TestMin64(t *testing.T) { | ||
if Min64(1_000_000_000_000, 2) != 2 { | ||
t.Errorf("Min64 doesn't work") | ||
} | ||
if Min64(-1, 1_000_000_000_000) != -1 { | ||
t.Errorf("Min64 doesn't work") | ||
} | ||
} |