File tree 1 file changed +31
-0
lines changed
IntegrationTests/TestSuites/Sources/PrimaryTests
1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -853,4 +853,35 @@ try test("JSValueDecoder") {
853
853
}
854
854
855
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
+
856
887
Expectation . wait ( expectations)
You can’t perform that action at this time.
0 commit comments