mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 14:42:11 +02:00
debug tests: MIMemoryTest: Use assertEquals instead of assertTrue when
possible Change-Id: If9fc8f3f0f1f2070b7bc4ea6dc23778001dc0092 Signed-off-by: Simon Marchi <simon.marchi@polymtl.ca>
This commit is contained in:
parent
d41b69136d
commit
a96fcd5a37
1 changed files with 61 additions and 91 deletions
|
@ -367,7 +367,7 @@ public class MIMemoryTest extends BaseTestCase {
|
|||
SyncUtil.readMemory(dmc, fBaseAddress, offset, word_size, count);
|
||||
} finally {
|
||||
// Ensure no MemoryChangedEvent event was received
|
||||
assertTrue("MemoryChangedEvent problem: expected " + 0 + ", received " + getEventCount(), getEventCount() == 0);
|
||||
assertEquals("MemoryChangedEvent problem: expected 0 events", 0, getEventCount());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -393,11 +393,11 @@ public class MIMemoryTest extends BaseTestCase {
|
|||
MemoryByte[] buffer = SyncUtil.readMemory(fMemoryDmc, fBaseAddress, offset, word_size, count);
|
||||
|
||||
// Ensure that we receive a block of invalid memory bytes
|
||||
assertTrue("Wrong value: expected '0, 32', received '" + buffer[0].getValue() + ", " + buffer[0].getFlags() + "'",
|
||||
(buffer[0].getValue() == (byte) 0) && (buffer[0].getFlags() == (byte) 32));
|
||||
assertEquals("Wrong value", (byte) 0, buffer[0].getValue());
|
||||
assertEquals("Wrong flags", (byte) 32, buffer[0].getFlags());
|
||||
|
||||
// Ensure no MemoryChangedEvent event was received
|
||||
assertTrue("MemoryChangedEvent problem: expected " + 0 + ", received " + getEventCount(), getEventCount() == 0);
|
||||
assertEquals("MemoryChangedEvent problem: expected 0 events", 0, getEventCount());
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
@ -426,7 +426,7 @@ public class MIMemoryTest extends BaseTestCase {
|
|||
SyncUtil.readMemory(fMemoryDmc, fBaseAddress, offset, 0, count);
|
||||
} finally {
|
||||
// Ensure no MemoryChangedEvent event was received
|
||||
assertTrue("MemoryChangedEvent problem: expected " + 0 + ", received " + getEventCount(), getEventCount() == 0);
|
||||
assertEquals("MemoryChangedEvent problem: expected 0 events", 0, getEventCount());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -457,7 +457,7 @@ public class MIMemoryTest extends BaseTestCase {
|
|||
SyncUtil.readMemory(fMemoryDmc, fBaseAddress, offset, word_size, count);
|
||||
} finally {
|
||||
// Ensure no MemoryChangedEvent event was received
|
||||
assertTrue("MemoryChangedEvent problem: expected " + 0 + ", received " + getEventCount(), getEventCount() == 0);
|
||||
assertEquals("MemoryChangedEvent problem: expected 0 events", 0, getEventCount());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -484,8 +484,7 @@ public class MIMemoryTest extends BaseTestCase {
|
|||
for (int i = 0; i < BLOCK_SIZE; i++) {
|
||||
IAddress address = fBaseAddress.add(i);
|
||||
MemoryByte[] buffer = SyncUtil.readMemory(fMemoryDmc, address, offset, word_size, count);
|
||||
assertTrue("Wrong value read at offset " + i + ": expected '" + 0 + "', received '" + buffer[0].getValue() + "'",
|
||||
(buffer[0].getValue() == (byte) 0));
|
||||
assertEquals("Wrong value read at offset " + i, (byte) 0, buffer[0].getValue());
|
||||
}
|
||||
|
||||
// Run to the point where the variable is initialized
|
||||
|
@ -497,12 +496,11 @@ public class MIMemoryTest extends BaseTestCase {
|
|||
for (int i = 0; i < BLOCK_SIZE; i++) {
|
||||
IAddress address = fBaseAddress.add(i);
|
||||
MemoryByte[] buffer = SyncUtil.readMemory(fMemoryDmc, address, offset, word_size, count);
|
||||
assertTrue("Wrong value read at offset " + i + ": expected '" + i + "', received '" + buffer[0].getValue() + "'",
|
||||
(buffer[0].getValue() == (byte) i));
|
||||
assertEquals("Wrong value read at offset " + i, (byte) i, buffer[0].getValue());
|
||||
}
|
||||
|
||||
// Ensure no MemoryChangedEvent event was received
|
||||
assertTrue("MemoryChangedEvent problem: expected " + 0 + ", received " + getEventCount(), getEventCount() == 0);
|
||||
assertEquals("MemoryChangedEvent problem: expected 0 events", 0, getEventCount());
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
@ -526,8 +524,8 @@ public class MIMemoryTest extends BaseTestCase {
|
|||
// Verify that all bytes are '0'
|
||||
for (int offset = 0; offset < BLOCK_SIZE; offset++) {
|
||||
MemoryByte[] buffer = SyncUtil.readMemory(fMemoryDmc, fBaseAddress, offset, word_size, count);
|
||||
assertTrue("Wrong value read at offset " + offset + ": expected '" + 0 + "', received '" + buffer[0].getValue() + "'",
|
||||
(buffer[0].getValue() == (byte) 0));
|
||||
assertEquals("Wrong value read at offset " + offset, (byte) 0, buffer[0].getValue());
|
||||
|
||||
}
|
||||
|
||||
// Run to the point where the array is set
|
||||
|
@ -538,12 +536,11 @@ public class MIMemoryTest extends BaseTestCase {
|
|||
// Verify that all bytes are set
|
||||
for (int offset = 0; offset < BLOCK_SIZE; offset++) {
|
||||
MemoryByte[] buffer = SyncUtil.readMemory(fMemoryDmc, fBaseAddress, offset, word_size, count);
|
||||
assertTrue("Wrong value read at offset " + offset + ": expected '" + offset + "', received '" + buffer[0].getValue() + "'",
|
||||
(buffer[0].getValue() == (byte) offset));
|
||||
assertEquals("Wrong value read at offset " + offset, (byte) offset, buffer[0].getValue());
|
||||
}
|
||||
|
||||
// Ensure no MemoryChangedEvent event was received
|
||||
assertTrue("MemoryChangedEvent problem: expected " + 0 + ", received " + getEventCount(), getEventCount() == 0);
|
||||
assertEquals("MemoryChangedEvent problem: expected 0 events", 0, getEventCount());
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
@ -570,8 +567,8 @@ public class MIMemoryTest extends BaseTestCase {
|
|||
|
||||
// Verify that all bytes are '0'
|
||||
for (int i = 0; i < count; i++) {
|
||||
assertTrue("Wrong value read at offset " + i + ": expected '" + 0 + "', received '" + buffer[i].getValue() + "'",
|
||||
(buffer[i].getValue() == (byte) 0));
|
||||
assertEquals("Wrong value read at offset " + i, (byte) 0, buffer[i].getValue());
|
||||
|
||||
}
|
||||
|
||||
// Run to the point where the variable is initialized
|
||||
|
@ -584,12 +581,12 @@ public class MIMemoryTest extends BaseTestCase {
|
|||
|
||||
// Verify that all bytes are '0'
|
||||
for (int i = 0; i < count; i++) {
|
||||
assertTrue("Wrong value read at offset " + i + ": expected '" + i + "', received '" + buffer[i].getValue() + "'",
|
||||
(buffer[i].getValue() == (byte) i));
|
||||
assertEquals("Wrong value read at offset " + i, (byte) i, buffer[i].getValue());
|
||||
|
||||
}
|
||||
|
||||
// Ensure no MemoryChangedEvent event was received
|
||||
assertTrue("MemoryChangedEvent problem: expected " + 0 + ", received " + getEventCount(), getEventCount() == 0);
|
||||
assertEquals("MemoryChangedEvent problem: expected 0 events", 0, getEventCount());
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
@ -624,7 +621,7 @@ public class MIMemoryTest extends BaseTestCase {
|
|||
SyncUtil.writeMemory(null, fBaseAddress, offset, word_size, count, buffer);
|
||||
} finally {
|
||||
// Ensure no MemoryChangedEvent event was received
|
||||
assertTrue("MemoryChangedEvent problem: expected " + 0 + ", received " + getEventCount(), getEventCount() == 0);
|
||||
assertEquals("MemoryChangedEvent problem: expected 0 events", 0, getEventCount());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -656,7 +653,7 @@ public class MIMemoryTest extends BaseTestCase {
|
|||
SyncUtil.writeMemory(fMemoryDmc, fBaseAddress, offset, word_size, count, buffer);
|
||||
} finally {
|
||||
// Ensure no MemoryChangedEvent event was received
|
||||
assertTrue("MemoryChangedEvent problem: expected " + 0 + ", received " + getEventCount(), getEventCount() == 0);
|
||||
assertEquals("MemoryChangedEvent problem: expected 0 events", 0, getEventCount());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -687,7 +684,7 @@ public class MIMemoryTest extends BaseTestCase {
|
|||
SyncUtil.writeMemory(fMemoryDmc, fBaseAddress, offset, 0, count, buffer);
|
||||
} finally {
|
||||
// Ensure no MemoryChangedEvent event was received
|
||||
assertTrue("MemoryChangedEvent problem: expected " + 0 + ", received " + getEventCount(), getEventCount() == 0);
|
||||
assertEquals("MemoryChangedEvent problem: expected 0 events", 0, getEventCount());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -719,7 +716,7 @@ public class MIMemoryTest extends BaseTestCase {
|
|||
SyncUtil.writeMemory(fMemoryDmc, fBaseAddress, offset, word_size, count, buffer);
|
||||
} finally {
|
||||
// Ensure no MemoryChangedEvent event was received
|
||||
assertTrue("MemoryChangedEvent problem: expected " + 0 + ", received " + getEventCount(), getEventCount() == 0);
|
||||
assertEquals("MemoryChangedEvent problem: expected 0 events", 0, getEventCount());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -751,7 +748,7 @@ public class MIMemoryTest extends BaseTestCase {
|
|||
SyncUtil.writeMemory(fMemoryDmc, fBaseAddress, offset, word_size, count, buffer);
|
||||
} finally {
|
||||
// Ensure no MemoryChangedEvent event was received
|
||||
assertTrue("MemoryChangedEvent problem: expected " + 0 + ", received " + getEventCount(), getEventCount() == 0);
|
||||
assertEquals("MemoryChangedEvent problem: expected 0 events", 0, getEventCount());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -780,8 +777,8 @@ public class MIMemoryTest extends BaseTestCase {
|
|||
|
||||
// [1] Ensure that the memory byte = 0
|
||||
MemoryByte[] block = SyncUtil.readMemory(fMemoryDmc, fBaseAddress, i, word_size, 1);
|
||||
assertTrue("Wrong value read at offset " + i + ": expected '" + 0 + "', received '" + block[0].getValue() + "'",
|
||||
(block[0].getValue() == (byte) 0));
|
||||
assertEquals("Wrong value read at offset " + i, (byte) 0, block[0].getValue());
|
||||
|
||||
|
||||
// [2] Write a byte value (count - i - 1)
|
||||
IAddress address = fBaseAddress.add(i);
|
||||
|
@ -793,21 +790,17 @@ public class MIMemoryTest extends BaseTestCase {
|
|||
// [3] Verify that the correct MemoryChangedEvent was sent
|
||||
// (I hardly believe there are no synchronization problems here...)
|
||||
// TODO FOR REVIEW: This assert fails
|
||||
//assertTrue("MemoryChangedEvent problem at offset " + i + ": expected " + (i + 1) + " events, received " + getEventCount(),
|
||||
// getEventCount() == (i + 1));
|
||||
//assertEquals("Incorrect count of MemoryChangedEvent at offset " + i, i + 1, getEventCount());
|
||||
//assertTrue("MemoryChangedEvent problem at offset " + i, fMemoryAddressesChanged[i]);
|
||||
|
||||
// [4] Verify that the memory byte was written correctly
|
||||
block = SyncUtil.readMemory(fMemoryDmc, fBaseAddress, i, word_size, 1);
|
||||
assertTrue("Wrong value read at offset " + i + ": expected '" + expected + "', received '" + block[0].getValue() + "'",
|
||||
(block[0].getValue() == expected));
|
||||
assertEquals("Wrong value read at offset " + i, expected, block[0].getValue());
|
||||
}
|
||||
|
||||
// Ensure the MemoryChangedEvent events were received
|
||||
assertTrue("MemoryChangedEvent problem: expected " + BLOCK_SIZE + " events, received " + getEventCount(),
|
||||
getEventCount() == BLOCK_SIZE);
|
||||
assertTrue("MemoryChangedEvent problem: expected " + BLOCK_SIZE + " distinct addresses, received " + getAddressCount(),
|
||||
getEventCount() == BLOCK_SIZE);
|
||||
assertEquals("Incorrect count of MemoryChangedEvent", BLOCK_SIZE, getEventCount());
|
||||
assertEquals("Incorrect count of events for distinct addresses", BLOCK_SIZE, getAddressCount());
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
@ -833,8 +826,7 @@ public class MIMemoryTest extends BaseTestCase {
|
|||
|
||||
// [1] Ensure that the memory byte = 0
|
||||
MemoryByte[] block = SyncUtil.readMemory(fMemoryDmc, fBaseAddress, offset, word_size, 1);
|
||||
assertTrue("Wrong value read at offset " + offset + ": expected '" + 0 + "', received '" + block[0].getValue() + "'",
|
||||
(block[0].getValue() == (byte) 0));
|
||||
assertEquals("Wrong value read at offset " + offset, (byte) 0, block[0].getValue());
|
||||
|
||||
// [2] Write a byte value (count - offset - 1)
|
||||
fWait.waitReset();
|
||||
|
@ -844,21 +836,17 @@ public class MIMemoryTest extends BaseTestCase {
|
|||
|
||||
// [3] Verify that the correct MemoryChangedEvent was sent
|
||||
// TODO FOR REVIEW: this fails
|
||||
//assertTrue("MemoryChangedEvent problem at offset " + offset + ": expected " + (offset + 1) + " events, received " + getEventCount(),
|
||||
// getEventCount() == (offset + 1));
|
||||
//assertEquals("Incorrect count of MemoryChangedEvent at offset " + offset, offset + 1, getEventCount());
|
||||
//assertTrue("MemoryChangedEvent problem at offset " + offset, fMemoryAddressesChanged[offset]);
|
||||
|
||||
// [4] Verify that the memory byte was written correctly
|
||||
block = SyncUtil.readMemory(fMemoryDmc, fBaseAddress, offset, word_size, 1);
|
||||
assertTrue("Wrong value read at offset " + offset + ": expected '" + expected + "', received '" + block[0].getValue() + "'",
|
||||
(block[0].getValue() == expected));
|
||||
assertEquals("Wrong value read at offset " + offset, expected, block[0].getValue());
|
||||
}
|
||||
|
||||
// Ensure the MemoryChangedEvent events were received
|
||||
assertTrue("MemoryChangedEvent problem: expected " + BLOCK_SIZE + " events, received " + getEventCount(),
|
||||
getEventCount() == BLOCK_SIZE);
|
||||
assertTrue("MemoryChangedEvent problem: expected " + BLOCK_SIZE + " distinct addresses, received " + getAddressCount(),
|
||||
getAddressCount() == BLOCK_SIZE);
|
||||
assertEquals("Incorrect count of MemoryChangedEvent", BLOCK_SIZE, getEventCount());
|
||||
assertEquals("Incorrect count of events for distinct addresses", BLOCK_SIZE, getAddressCount());
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
@ -883,8 +871,7 @@ public class MIMemoryTest extends BaseTestCase {
|
|||
// Make sure that the memory block is zeroed
|
||||
MemoryByte[] block = SyncUtil.readMemory(fMemoryDmc, fBaseAddress, offset, word_size, count);
|
||||
for (int i = 0; i < count; i++) {
|
||||
assertTrue("Wrong value read at offset " + i + ": expected '" + 0 + "', received '" + block[i].getValue() + "'",
|
||||
(block[i].getValue() == (byte) 0));
|
||||
assertEquals("Wrong value read at offset " + i, (byte) 0, block[i].getValue());
|
||||
}
|
||||
|
||||
// Write an initialized memory block
|
||||
|
@ -897,15 +884,12 @@ public class MIMemoryTest extends BaseTestCase {
|
|||
// Make sure that the memory block is initialized
|
||||
block = SyncUtil.readMemory(fMemoryDmc, fBaseAddress, offset, word_size, count);
|
||||
for (int i = 0; i < count; i++) {
|
||||
assertTrue("Wrong value read at offset " + i + ": expected '" + 0 + "', received '" + block[i].getValue() + "'",
|
||||
(block[i].getValue() == (byte) i));
|
||||
assertEquals("Wrong value read at offset " + i, (byte) i, block[i].getValue());
|
||||
}
|
||||
|
||||
// Ensure the MemoryChangedEvent events were received
|
||||
assertTrue("MemoryChangedEvent problem: expected " + 1 + " event, received " + getEventCount(),
|
||||
getEventCount() == 1);
|
||||
assertTrue("MemoryChangedEvent problem: expected " + BLOCK_SIZE + " distinct addresses, received " + getAddressCount(),
|
||||
getAddressCount() == BLOCK_SIZE);
|
||||
assertEquals("Incorrect count of MemoryChangedEvent", 1, getEventCount());
|
||||
assertEquals("Incorrect count of events for distinct addresses", BLOCK_SIZE, getAddressCount());
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
@ -940,7 +924,7 @@ public class MIMemoryTest extends BaseTestCase {
|
|||
SyncUtil.fillMemory(null, fBaseAddress, offset, word_size, count, pattern);
|
||||
} finally {
|
||||
// Ensure no MemoryChangedEvent event was received
|
||||
assertTrue("MemoryChangedEvent problem: expected " + 0 + ", received " + getEventCount(), getEventCount() == 0);
|
||||
assertEquals("Incorrect count of MemoryChangedEvent", 0, getEventCount());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -978,7 +962,7 @@ public class MIMemoryTest extends BaseTestCase {
|
|||
SyncUtil.fillMemory(fMemoryDmc, fBaseAddress, offset, word_size, count, pattern);
|
||||
} finally {
|
||||
// Ensure no MemoryChangedEvent event was received
|
||||
assertTrue("MemoryChangedEvent problem: expected " + 0 + ", received " + getEventCount(), getEventCount() == 0);
|
||||
assertEquals("MemoryChangedEvent problem: expected 0 events", 0, getEventCount());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1009,7 +993,7 @@ public class MIMemoryTest extends BaseTestCase {
|
|||
SyncUtil.fillMemory(fMemoryDmc, fBaseAddress, offset, 0, count, pattern);
|
||||
} finally {
|
||||
// Ensure no MemoryChangedEvent event was received
|
||||
assertTrue("MemoryChangedEvent problem: expected " + 0 + ", received " + getEventCount(), getEventCount() == 0);
|
||||
assertEquals("MemoryChangedEvent problem: expected 0 events", 0, getEventCount());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1041,7 +1025,7 @@ public class MIMemoryTest extends BaseTestCase {
|
|||
SyncUtil.fillMemory(fMemoryDmc, fBaseAddress, offset, word_size, count, pattern);
|
||||
} finally {
|
||||
// Ensure no MemoryChangedEvent event was received
|
||||
assertTrue("MemoryChangedEvent problem: expected " + 0 + ", received " + getEventCount(), getEventCount() == 0);
|
||||
assertEquals("MemoryChangedEvent problem: expected 0 events", 0, getEventCount());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1073,7 +1057,7 @@ public class MIMemoryTest extends BaseTestCase {
|
|||
SyncUtil.fillMemory(fMemoryDmc, fBaseAddress, offset, word_size, count, pattern);
|
||||
} finally {
|
||||
// Ensure no MemoryChangedEvent event was received
|
||||
assertTrue("MemoryChangedEvent problem: expected " + 0 + ", received " + getEventCount(), getEventCount() == 0);
|
||||
assertEquals("MemoryChangedEvent problem: expected 0 events", 0, getEventCount());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1102,8 +1086,7 @@ public class MIMemoryTest extends BaseTestCase {
|
|||
// Ensure that the memory is zeroed
|
||||
MemoryByte[] block = SyncUtil.readMemory(fMemoryDmc, fBaseAddress, offset, word_size, count * length);
|
||||
for (int i = 0; i < (count * length); i++)
|
||||
assertTrue("Wrong value read at offset " + i + ": expected '" + 0 + "', received '" + block[i].getValue() + "'",
|
||||
(block[i].getValue() == (byte) 0));
|
||||
assertEquals("Wrong value read at offset " + i, (byte) 0, block[i].getValue());
|
||||
|
||||
for (int i = 0; i < BLOCK_SIZE; i += length) {
|
||||
IAddress address = fBaseAddress.add(i);
|
||||
|
@ -1115,15 +1098,12 @@ public class MIMemoryTest extends BaseTestCase {
|
|||
for (int i = 0; i < count; i++)
|
||||
for (int j = 0; j < length; j++) {
|
||||
int index = i * length + j;
|
||||
assertTrue("Wrong value read at offset " + index + ": expected '" + j + "', received '" + block[index].getValue() + "'",
|
||||
(block[index].getValue() == (byte) j));
|
||||
assertEquals("Wrong value read at offset " + index, (byte) j, block[index].getValue());
|
||||
}
|
||||
|
||||
// Ensure the MemoryChangedEvent events were received
|
||||
assertTrue("MemoryChangedEvent problem: expected " + (BLOCK_SIZE / length) + " events, received " + getEventCount(),
|
||||
getEventCount() == (BLOCK_SIZE / length));
|
||||
assertTrue("MemoryChangedEvent problem: expected " + BLOCK_SIZE + " distinct addresses, received " + getAddressCount(),
|
||||
getAddressCount() == BLOCK_SIZE);
|
||||
assertEquals("Incorrect count of MemoryChangedEvent", BLOCK_SIZE / length, getEventCount());
|
||||
assertEquals("Incorrect count of events for distinct addresses", BLOCK_SIZE, getAddressCount());
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
@ -1151,8 +1131,7 @@ public class MIMemoryTest extends BaseTestCase {
|
|||
// Ensure that the memory is zeroed
|
||||
MemoryByte[] block = SyncUtil.readMemory(fMemoryDmc, fBaseAddress, offset, word_size, count * length);
|
||||
for (int i = 0; i < (count * length); i++)
|
||||
assertTrue("Wrong value read at offset " + i + ": expected '" + 0 + "', received '" + block[i].getValue() + "'",
|
||||
(block[i].getValue() == (byte) 0));
|
||||
assertEquals("Wrong value read at offset " + i, 0, block[i].getValue());
|
||||
|
||||
for (int i = 0; i < (BLOCK_SIZE / length); i++) {
|
||||
offset = i * length;
|
||||
|
@ -1164,15 +1143,13 @@ public class MIMemoryTest extends BaseTestCase {
|
|||
for (int i = 0; i < count; i++)
|
||||
for (int j = 0; j < length; j++) {
|
||||
int index = i * length + j;
|
||||
assertTrue("Wrong value read at offset " + index + ": expected '" + j + "', received '" + block[index].getValue() + "'",
|
||||
(block[index].getValue() == (byte) j));
|
||||
assertEquals("Wrong value read at offset " + index, (byte) j, block[index].getValue());
|
||||
}
|
||||
|
||||
// Ensure the MemoryChangedEvent events were received
|
||||
assertTrue("MemoryChangedEvent problem: expected " + (BLOCK_SIZE / length) + " events, received " + getEventCount(),
|
||||
getEventCount() == (BLOCK_SIZE / length));
|
||||
assertTrue("MemoryChangedEvent problem: expected " + BLOCK_SIZE + " distinct addresses, received " + getAddressCount(),
|
||||
getAddressCount() == BLOCK_SIZE);
|
||||
assertEquals("Incorrect count of MemoryChangedEvent", BLOCK_SIZE / length, getEventCount());
|
||||
assertEquals("Incorrect count of events for distinct addresses", BLOCK_SIZE, getAddressCount());
|
||||
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
@ -1200,8 +1177,7 @@ public class MIMemoryTest extends BaseTestCase {
|
|||
// Ensure that the memory is zeroed
|
||||
MemoryByte[] block = SyncUtil.readMemory(fMemoryDmc, fBaseAddress, offset, word_size, count * length);
|
||||
for (int i = 0; i < (count * length); i++)
|
||||
assertTrue("Wrong value read at offset " + i + ": expected '" + 0 + "', received '" + block[i].getValue() + "'",
|
||||
(block[i].getValue() == (byte) 0));
|
||||
assertEquals("Wrong value read at offset " + i, (byte) 0, block[i].getValue());
|
||||
|
||||
// Write the pattern [count] times
|
||||
SyncUtil.fillMemory(fMemoryDmc, fBaseAddress, offset, word_size, count, pattern);
|
||||
|
@ -1211,15 +1187,13 @@ public class MIMemoryTest extends BaseTestCase {
|
|||
for (int i = 0; i < count; i++)
|
||||
for (int j = 0; j < length; j++) {
|
||||
int index = i * length + j;
|
||||
assertTrue("Wrong value read at offset " + index + ": expected '" + j + "', received '" + block[index].getValue() + "'",
|
||||
(block[index].getValue() == (byte) j));
|
||||
assertEquals("Wrong value read at offset " + index, (byte) j, block[index].getValue());
|
||||
}
|
||||
|
||||
// Ensure the MemoryChangedEvent events were received
|
||||
assertTrue("MemoryChangedEvent problem: expected " + 1 + " events, received " + getEventCount(),
|
||||
getEventCount() == 1);
|
||||
assertTrue("MemoryChangedEvent problem: expected " + BLOCK_SIZE + " distinct addresses, received " + getAddressCount(),
|
||||
getAddressCount() == BLOCK_SIZE);
|
||||
assertEquals("Incorrect count of MemoryChangedEvent", 1, getEventCount());
|
||||
assertEquals("Incorrect count of events for distinct addresses", BLOCK_SIZE, getAddressCount());
|
||||
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
@ -1278,10 +1252,8 @@ public class MIMemoryTest extends BaseTestCase {
|
|||
|
||||
// Ensure the MemoryChangedEvent events were received
|
||||
// TODO FOR REVIEW: This fails
|
||||
//assertTrue("MemoryChangedEvent problem: expected " + BLOCK_SIZE + " events, received " + getEventCount(),
|
||||
// getEventCount() == BLOCK_SIZE);
|
||||
//assertTrue("MemoryChangedEvent problem: expected " + BLOCK_SIZE + " distinct addresses, received " + getAddressCount(),
|
||||
// getAddressCount() == BLOCK_SIZE);
|
||||
//assertEquals("Incorrect count of MemoryChangedEvent", BLOCK_SIZE, getEventCount());
|
||||
//assertEquals("Incorrect count of events for distinct addresses", BLOCK_SIZE, getAddressCount());
|
||||
|
||||
// Verify asynchronously that all bytes are set
|
||||
fWait.waitReset();
|
||||
|
@ -1306,8 +1278,7 @@ public class MIMemoryTest extends BaseTestCase {
|
|||
|
||||
// Verify that all bytes are correctly set
|
||||
for (int i = 0; i < count; i++) {
|
||||
assertEquals("Wrong value read at offset " + i,
|
||||
(byte) (offset + i), buffer[i].getValue());
|
||||
assertEquals("Wrong value read at offset " + i, (byte) (offset + i), buffer[i].getValue());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1359,7 +1330,6 @@ public class MIMemoryTest extends BaseTestCase {
|
|||
memoryCacheReadHelper(0, BLOCK_SIZE, word_size);
|
||||
|
||||
// Ensure no MemoryChangedEvent event was received
|
||||
assertEquals("MemoryChangedEvent problem: expected 0 events received.",
|
||||
0, getEventCount());
|
||||
assertEquals("Incorrect count of MemoryChangedEvent", 0, getEventCount());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue