Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(606)

Unified Diff: runtime/vm/bigint_operations_test.cc

Issue 9625027: Fix bit-or and bit-xor for two negative bigints. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/bigint_operations.cc ('k') | tests/co19/co19-runtime.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/bigint_operations_test.cc
diff --git a/runtime/vm/bigint_operations_test.cc b/runtime/vm/bigint_operations_test.cc
index 75b24642ef4da04f1d98402b9838e202496f0a3f..81e0f16262d98af134bc6c7b687566471bd9af75 100644
--- a/runtime/vm/bigint_operations_test.cc
+++ b/runtime/vm/bigint_operations_test.cc
@@ -1030,15 +1030,14 @@ TEST_CASE(BigintBitAnd) {
static void TestBigintBitOr(const char* a, const char* b, const char* result) {
const Bigint& bigint_a = Bigint::Handle(BigintOperations::NewFromCString(a));
const Bigint& bigint_b = Bigint::Handle(BigintOperations::NewFromCString(b));
- const Bigint& anded =
+ const Bigint& ored =
Bigint::Handle(BigintOperations::BitOr(bigint_a, bigint_b));
- const char* str_anded = BigintOperations::ToHexCString(anded, &ZoneAllocator);
- EXPECT_STREQ(result, str_anded);
- const Bigint& anded2 =
+ const char* str_ored = BigintOperations::ToHexCString(ored, &ZoneAllocator);
+ EXPECT_STREQ(result, str_ored);
+ const Bigint& ored2 =
Bigint::Handle(BigintOperations::BitOr(bigint_b, bigint_a));
- const char* str_anded2 = BigintOperations::ToHexCString(anded2,
- &ZoneAllocator);
- EXPECT_STREQ(result, str_anded2);
+ const char* str_ored2 = BigintOperations::ToHexCString(ored2, &ZoneAllocator);
+ EXPECT_STREQ(result, str_ored2);
}
@@ -1104,6 +1103,7 @@ TEST_CASE(BigintBitOr) {
TestBigintBitOr("-0x100000000", "-0x100000001", "-0x1");
TestBigintBitOr("-0x100000000000000", "-0x100000000000001", "-0x1");
TestBigintBitOr("-0x10000000000000000", "-0x10000000000000001", "-0x1");
+ TestBigintBitOr("-0x10000000000000000", "-0x1", "-0x1");
}
@@ -1119,6 +1119,26 @@ static void TestBigintBitXor(const char* a, const char* b, const char* result) {
const char* str_xored2 = BigintOperations::ToHexCString(xored2,
&ZoneAllocator);
EXPECT_STREQ(result, str_xored2);
+ const Bigint& xored3 =
+ Bigint::Handle(BigintOperations::BitXor(bigint_a, xored2));
+ const char* str_xored3 = BigintOperations::ToHexCString(xored3,
+ &ZoneAllocator);
+ EXPECT_STREQ(b, str_xored3);
+ const Bigint& xored4 =
+ Bigint::Handle(BigintOperations::BitXor(xored2, bigint_a));
+ const char* str_xored4 = BigintOperations::ToHexCString(xored4,
+ &ZoneAllocator);
+ EXPECT_STREQ(b, str_xored4);
+ const Bigint& xored5 =
+ Bigint::Handle(BigintOperations::BitXor(bigint_b, xored2));
+ const char* str_xored5 = BigintOperations::ToHexCString(xored5,
+ &ZoneAllocator);
+ EXPECT_STREQ(a, str_xored5);
+ const Bigint& xored6 =
+ Bigint::Handle(BigintOperations::BitXor(xored2, bigint_b));
+ const char* str_xored6 = BigintOperations::ToHexCString(xored6,
+ &ZoneAllocator);
+ EXPECT_STREQ(a, str_xored6);
}
« no previous file with comments | « runtime/vm/bigint_operations.cc ('k') | tests/co19/co19-runtime.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698