|
@@ -11,10 +11,10 @@ static void testSetRead(Test& test) {
|
|
|
bits[1] = 2;
|
|
|
bits[2] = 3;
|
|
|
bits[3] = 4;
|
|
|
- test.checkEqual(1, static_cast<int> (bits[0]), "set and read correct value");
|
|
|
- test.checkEqual(2, static_cast<int> (bits[1]), "set and read correct value");
|
|
|
- test.checkEqual(3, static_cast<int> (bits[2]), "set and read correct value");
|
|
|
- test.checkEqual(4, static_cast<int> (bits[3]), "set and read correct value");
|
|
|
+ test.checkEqual(1, static_cast<int> (bits[0]), "set and read correct value 1");
|
|
|
+ test.checkEqual(2, static_cast<int> (bits[1]), "set and read correct value 2");
|
|
|
+ test.checkEqual(3, static_cast<int> (bits[2]), "set and read correct value 3");
|
|
|
+ test.checkEqual(4, static_cast<int> (bits[3]), "set and read correct value 4");
|
|
|
}
|
|
|
|
|
|
static void testBigSetRead(Test& test) {
|
|
@@ -51,20 +51,20 @@ static void testReadOnly(Test& test) {
|
|
|
bits[2] = 3;
|
|
|
bits[3] = 4;
|
|
|
const BitArray<4, 3> bits2 = bits;
|
|
|
- test.checkEqual(1, bits2[0], "can read from const");
|
|
|
- test.checkEqual(2, bits2[1], "can read from const");
|
|
|
- test.checkEqual(3, bits2[2], "can read from const");
|
|
|
- test.checkEqual(4, bits2[3], "can read from const");
|
|
|
+ test.checkEqual(1, bits2[0], "can read from const 1");
|
|
|
+ test.checkEqual(2, bits2[1], "can read from const 2");
|
|
|
+ test.checkEqual(3, bits2[2], "can read from const 3");
|
|
|
+ test.checkEqual(4, bits2[3], "can read from const 4");
|
|
|
}
|
|
|
|
|
|
static void testChainedSet(Test& test) {
|
|
|
BitArray<4, 3> bits;
|
|
|
bits[0] = bits[2] = bits[3] = 2;
|
|
|
bits[3] = bits[1] = 7;
|
|
|
- test.checkEqual(2, static_cast<int> (bits[0]), "chained set sets correct value");
|
|
|
- test.checkEqual(7, static_cast<int> (bits[1]), "chained set sets correct value");
|
|
|
- test.checkEqual(2, static_cast<int> (bits[2]), "chained set sets correct value");
|
|
|
- test.checkEqual(7, static_cast<int> (bits[3]), "chained set sets correct value");
|
|
|
+ test.checkEqual(2, static_cast<int> (bits[0]), "chained set sets correct value 1");
|
|
|
+ test.checkEqual(7, static_cast<int> (bits[1]), "chained set sets correct value 2");
|
|
|
+ test.checkEqual(2, static_cast<int> (bits[2]), "chained set sets correct value 3");
|
|
|
+ test.checkEqual(7, static_cast<int> (bits[3]), "chained set sets correct value 4");
|
|
|
}
|
|
|
|
|
|
static void testToString1(Test& test) {
|
|
@@ -73,17 +73,13 @@ static void testToString1(Test& test) {
|
|
|
bits[1] = 2;
|
|
|
bits[2] = 3;
|
|
|
bits[3] = 4;
|
|
|
- String s;
|
|
|
- s.append(bits);
|
|
|
- test.checkEqual(String("[1, 2, 3, 4]"), s, "bit array to string 1");
|
|
|
+ test.checkEqual(String("[1, 2, 3, 4]"), String(bits), "bit array to string 1");
|
|
|
}
|
|
|
|
|
|
static void testToString2(Test& test) {
|
|
|
BitArray<1, 3> a;
|
|
|
a[0] = 1;
|
|
|
- String s;
|
|
|
- s.append(a);
|
|
|
- test.checkEqual(String("[1]"), s, "bit array to string 1");
|
|
|
+ test.checkEqual(String("[1]"), String(a), "bit array to string 1");
|
|
|
}
|
|
|
|
|
|
void BitArrayTests::test() {
|