-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
internal: get rid of architecture specific constants (#191)
- Loading branch information
1 parent
93d5865
commit 00de7ca
Showing
4 changed files
with
51 additions
and
14 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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,37 @@ | ||
package c | ||
|
||
import ( | ||
"math/bits" | ||
"testing" | ||
) | ||
|
||
func TestMaxScale(t *testing.T) { | ||
check := func(t *testing.T, max int64, maxInf int64) { | ||
if MaxScale != max { | ||
t.Fatalf("MaxScale: got %d, expected %d", MaxScale, max) | ||
} | ||
if MaxScaleInf != maxInf { | ||
t.Fatalf("MaxScaleInf: got %d, expected %d", MaxScaleInf, maxInf) | ||
} | ||
} | ||
switch n := bits.UintSize; n { | ||
case 32: | ||
if is32bit != 1 { | ||
t.Fatalf("is32bit: got %d, expected %d", is32bit, 1) | ||
} | ||
if is64bit != 0 { | ||
t.Fatalf("is64bit: got %d, expected %d", is64bit, 0) | ||
} | ||
check(t, maxScale32, maxScaleInf32) | ||
case 64: | ||
if is32bit != 0 { | ||
t.Fatalf("is32bit: got %d, expected %d", is32bit, 0) | ||
} | ||
if is64bit != 1 { | ||
t.Fatalf("is64bit: got %d, expected %d", is64bit, 1) | ||
} | ||
check(t, maxScale64, maxScaleInf64) | ||
default: | ||
t.Fatalf("unknown bit size: %d", n) | ||
} | ||
} |