-
Notifications
You must be signed in to change notification settings - Fork 0
/
bitwise_test.go
31 lines (22 loc) · 1.02 KB
/
bitwise_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package gost
import "testing"
func Test_I128_Shl(t *testing.T) {
t.Parallel()
AssertEq(I128_FromU64(U64_MAX).Shl(I128_FromI64(1)).ToString(), "36893488147419103230", "I128.Shl out of U64 range")
AssertEq(I128_FromU64(30).Shl(I128_FromI64(1)).ToString(), "60", "I128.Shl")
}
func Test_U128_Shl(t *testing.T) {
t.Parallel()
AssertEq(U128_FromU64(U64_MAX).Shl(U128_FromU64(1)).ToString(), "36893488147419103230", "U128.Shl out of U64 range")
AssertEq(U128_FromU64(30).Shl(U128_FromU64(1)).ToString(), "60", "U128.Shl")
}
func Test_I128_Shr(t *testing.T) {
t.Parallel()
AssertEq(I128_FromU64(U64_MAX).Shl(I128_FromI64(1)).Shr(I128_FromI64(1)), I128_FromU64(U64_MAX), "I128.Shr out of U64 range")
AssertEq(I128_FromU64(60).Shr(I128_FromI64(1)).ToString(), "30", "I128.Shr")
}
func Test_U128_Shr(t *testing.T) {
t.Parallel()
AssertEq(U128_FromU64(U64_MAX).Shl(U128_FromU64(1)).Shr(U128_FromU64(1)), U128_FromU64(U64_MAX), "U128.Shr out of U64 range")
AssertEq(U128_FromU64(60).Shr(U128_FromU64(1)).ToString(), "30", "U128.Shr")
}