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

Unified Diff: tests/BitSetTest.cpp

Issue 2265623002: src/utils/SkBitSet: simplify (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2016-08-19 (Friday) 16:05:19 EDT Created 4 years, 4 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 | « src/xps/SkXPSDevice.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/BitSetTest.cpp
diff --git a/tests/BitSetTest.cpp b/tests/BitSetTest.cpp
index 716f4146706113027d6c3ee8a0eac50bc0b97be5..6fc8351b3c315bd07031cfa4ecfa84ad3a0f969f 100644
--- a/tests/BitSetTest.cpp
+++ b/tests/BitSetTest.cpp
@@ -10,64 +10,30 @@
DEF_TEST(BitSet, reporter) {
SkBitSet set0(65536);
- REPORTER_ASSERT(reporter, set0.isBitSet(0) == false);
- REPORTER_ASSERT(reporter, set0.isBitSet(32767) == false);
- REPORTER_ASSERT(reporter, set0.isBitSet(65535) == false);
-
- SkBitSet set1(65536);
- REPORTER_ASSERT(reporter, set0 == set1);
-
- set0.setBit(22, true);
- REPORTER_ASSERT(reporter, set0.isBitSet(22) == true);
- set0.setBit(24, true);
- REPORTER_ASSERT(reporter, set0.isBitSet(24) == true);
- set0.setBit(35, true); // on a different DWORD
- REPORTER_ASSERT(reporter, set0.isBitSet(35) == true);
- set0.setBit(22, false);
- REPORTER_ASSERT(reporter, set0.isBitSet(22) == false);
- REPORTER_ASSERT(reporter, set0.isBitSet(24) == true);
- REPORTER_ASSERT(reporter, set0.isBitSet(35) == true);
+ REPORTER_ASSERT(reporter, set0.has(0) == false);
+ REPORTER_ASSERT(reporter, set0.has(32767) == false);
+ REPORTER_ASSERT(reporter, set0.has(65535) == false);
+
+ set0.set(22);
+ REPORTER_ASSERT(reporter, set0.has(22) == true);
+ set0.set(24);
+ REPORTER_ASSERT(reporter, set0.has(24) == true);
+ set0.set(35); // on a different DWORD
+ REPORTER_ASSERT(reporter, set0.has(35) == true);
+ REPORTER_ASSERT(reporter, set0.has(24) == true);
+ REPORTER_ASSERT(reporter, set0.has(35) == true);
SkTDArray<unsigned int> data;
set0.exportTo(&data);
- REPORTER_ASSERT(reporter, data.count() == 2);
- REPORTER_ASSERT(reporter, data[0] == 24);
- REPORTER_ASSERT(reporter, data[1] == 35);
-
- set1.setBit(12345, true);
- set1.orBits(set0);
- REPORTER_ASSERT(reporter, set0.isBitSet(12345) == false);
- REPORTER_ASSERT(reporter, set1.isBitSet(12345) == true);
- REPORTER_ASSERT(reporter, set1.isBitSet(22) == false);
- REPORTER_ASSERT(reporter, set1.isBitSet(24) == true);
- REPORTER_ASSERT(reporter, set0.isBitSet(35) == true);
- REPORTER_ASSERT(reporter, set1 != set0);
-
- set1.clearAll();
- REPORTER_ASSERT(reporter, set0.isBitSet(12345) == false);
- REPORTER_ASSERT(reporter, set1.isBitSet(12345) == false);
- REPORTER_ASSERT(reporter, set1.isBitSet(22) == false);
- REPORTER_ASSERT(reporter, set1.isBitSet(24) == false);
- REPORTER_ASSERT(reporter, set1.isBitSet(35) == false);
+ REPORTER_ASSERT(reporter, data.count() == 3);
+ REPORTER_ASSERT(reporter, data[0] == 22);
+ REPORTER_ASSERT(reporter, data[1] == 24);
+ REPORTER_ASSERT(reporter, data[2] == 35);
- set1.orBits(set0);
- REPORTER_ASSERT(reporter, set1 == set0);
-
- SkBitSet set2(1);
- SkBitSet set3(1);
- SkBitSet set4(4);
- SkBitSet set5(33);
-
- REPORTER_ASSERT(reporter, set2 == set3);
- REPORTER_ASSERT(reporter, set2 != set4);
- REPORTER_ASSERT(reporter, set2 != set5);
-
- set2.setBit(0, true);
- REPORTER_ASSERT(reporter, set2 != set5);
- set5.setBit(0, true);
- REPORTER_ASSERT(reporter, set2 != set5);
- REPORTER_ASSERT(reporter, set2 != set3);
- set3.setBit(0, true);
- REPORTER_ASSERT(reporter, set2 == set3);
- set3.clearAll();
+ SkBitSet set1(65536);
+ set1.set(12345);
+ REPORTER_ASSERT(reporter, set0.has(12345) == false);
+ REPORTER_ASSERT(reporter, set1.has(12345) == true);
+ REPORTER_ASSERT(reporter, set1.has(22) == false);
+ REPORTER_ASSERT(reporter, set0.has(35) == true);
}
« no previous file with comments | « src/xps/SkXPSDevice.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698