File tree Expand file tree Collapse file tree 3 files changed +37
-32
lines changed
IntegrationTests/TestSuites Expand file tree Collapse file tree 3 files changed +37
-32
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ let package = Package(
25
25
targets: [
26
26
. target( name: " CHelpers " ) ,
27
27
. target( name: " PrimaryTests " , dependencies: [
28
+ . product( name: " JavaScriptKit_I64 " , package : " JavaScriptKit " ) ,
28
29
" JavaScriptKit " ,
29
30
" CHelpers " ,
30
31
] ) ,
Original file line number Diff line number Diff line change
1
+ import JavaScriptKit
2
+ import JavaScriptKit_I64
3
+
4
+ func testI64( ) throws {
5
+ try test ( " BigInt " ) {
6
+ func expectPassesThrough( signed value: Int64 ) throws {
7
+ let bigInt = JSBigInt ( value)
8
+ try expectEqual ( bigInt. description, value. description)
9
+ }
10
+
11
+ func expectPassesThrough( unsigned value: UInt64 ) throws {
12
+ let bigInt = JSBigInt ( unsigned: value)
13
+ try expectEqual ( bigInt. description, value. description)
14
+ }
15
+
16
+ try expectPassesThrough ( signed: 0 )
17
+ try expectPassesThrough ( signed: 1 << 62 )
18
+ try expectPassesThrough ( signed: - 2305 )
19
+ for _ in 0 ..< 100 {
20
+ try expectPassesThrough ( signed: . random( in: . min ... . max) )
21
+ }
22
+ try expectPassesThrough ( signed: . min)
23
+ try expectPassesThrough ( signed: . max)
24
+
25
+ try expectPassesThrough ( unsigned: 0 )
26
+ try expectPassesThrough ( unsigned: 1 << 62 )
27
+ try expectPassesThrough ( unsigned: 1 << 63 )
28
+ try expectPassesThrough ( unsigned: . min)
29
+ try expectPassesThrough ( unsigned: . max)
30
+ try expectPassesThrough ( unsigned: ~ 0 )
31
+ for _ in 0 ..< 100 {
32
+ try expectPassesThrough ( unsigned: . random( in: . min ... . max) )
33
+ }
34
+ }
35
+ }
Original file line number Diff line number Diff line change @@ -852,36 +852,5 @@ try test("JSValueDecoder") {
852
852
try expectEqual ( decodedTama. isCat, true )
853
853
}
854
854
855
-
856
- try test ( " BigInt " ) {
857
- func expectPassesThrough( signed value: Int64 ) throws {
858
- let bigInt = JSBigInt ( value)
859
- try expectEqual ( bigInt. description, value. description)
860
- }
861
-
862
- func expectPassesThrough( unsigned value: UInt64 ) throws {
863
- let bigInt = JSBigInt ( unsigned: value)
864
- try expectEqual ( bigInt. description, value. description)
865
- }
866
-
867
- try expectPassesThrough ( signed: 0 )
868
- try expectPassesThrough ( signed: 1 << 62 )
869
- try expectPassesThrough ( signed: - 2305 )
870
- for _ in 0 ..< 100 {
871
- try expectPassesThrough ( signed: . random( in: . min ... . max) )
872
- }
873
- try expectPassesThrough ( signed: . min)
874
- try expectPassesThrough ( signed: . max)
875
-
876
- try expectPassesThrough ( unsigned: 0 )
877
- try expectPassesThrough ( unsigned: 1 << 62 )
878
- try expectPassesThrough ( unsigned: 1 << 63 )
879
- try expectPassesThrough ( unsigned: . min)
880
- try expectPassesThrough ( unsigned: . max)
881
- try expectPassesThrough ( unsigned: ~ 0 )
882
- for _ in 0 ..< 100 {
883
- try expectPassesThrough ( unsigned: . random( in: . min ... . max) )
884
- }
885
- }
886
-
855
+ try testI64 ( )
887
856
Expectation . wait ( expectations)
You can’t perform that action at this time.
0 commit comments