OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "platform/assert.h" | 5 #include "platform/assert.h" |
6 #include "vm/bigint_operations.h" | 6 #include "vm/bigint_operations.h" |
7 #include "vm/object.h" | 7 #include "vm/object.h" |
8 #include "vm/object_store.h" | 8 #include "vm/object_store.h" |
9 #include "vm/unit_test.h" | 9 #include "vm/unit_test.h" |
10 | 10 |
(...skipping 960 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
971 | 971 |
972 | 972 |
973 static void TestBigintRightShift( | 973 static void TestBigintRightShift( |
974 const char* a, int amount, const char* result) { | 974 const char* a, int amount, const char* result) { |
975 const Bigint& bigint_a = Bigint::Handle(BigintOperations::NewFromCString(a)); | 975 const Bigint& bigint_a = Bigint::Handle(BigintOperations::NewFromCString(a)); |
976 const Bigint& shifted = | 976 const Bigint& shifted = |
977 Bigint::Handle(BigintOperations::ShiftRight(bigint_a, amount)); | 977 Bigint::Handle(BigintOperations::ShiftRight(bigint_a, amount)); |
978 const char* str_shifted = BigintOperations::ToHexCString(shifted, | 978 const char* str_shifted = BigintOperations::ToHexCString(shifted, |
979 &ZoneAllocator); | 979 &ZoneAllocator); |
980 if (strcmp(result, str_shifted)) { | 980 if (strcmp(result, str_shifted)) { |
981 WARN2("%s >> %d", a, amount); | 981 FAIL2("%s >> %d", a, amount); |
982 } | 982 } |
983 EXPECT_STREQ(result, str_shifted); | 983 EXPECT_STREQ(result, str_shifted); |
984 } | 984 } |
985 | 985 |
986 | 986 |
987 TEST_CASE(BigintRightShift) { | 987 TEST_CASE(BigintRightShift) { |
988 const char* zero = "0x0"; | 988 const char* zero = "0x0"; |
989 const char* one = "0x1"; | 989 const char* one = "0x1"; |
990 const char* minus_one = "-0x1"; | 990 const char* minus_one = "-0x1"; |
991 | 991 |
(...skipping 1231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2223 "123456789012345678901234567890123456789012345678901234567890123456789012" | 2223 "123456789012345678901234567890123456789012345678901234567890123456789012" |
2224 "345678901234567890123456789012345678901234567890123456789012345678901234" | 2224 "345678901234567890123456789012345678901234567890123456789012345678901234" |
2225 "567890123456789012345678901234567890123456789012345678901234567890123456" | 2225 "567890123456789012345678901234567890123456789012345678901234567890123456" |
2226 "789012345678901234567890123456789012345678901234567890123456789012345678" | 2226 "789012345678901234567890123456789012345678901234567890123456789012345678" |
2227 "90123456789012345678901234567890", | 2227 "90123456789012345678901234567890", |
2228 "0x1234567890ABCDEF01234567890ABCDEF01234567890ABCDEF01234567890ABCDEF" | 2228 "0x1234567890ABCDEF01234567890ABCDEF01234567890ABCDEF01234567890ABCDEF" |
2229 "01234567890ABCDEE"); | 2229 "01234567890ABCDEE"); |
2230 } | 2230 } |
2231 | 2231 |
2232 } // namespace dart | 2232 } // namespace dart |
OLD | NEW |