Skip to content

Commit 6a401d6

Browse files
author
Wang, Gang(Gary)
committed
MNEMONIC-294: Use long type for index in ChunkBuffer test case
1 parent 5aa6f02 commit 6a401d6

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

mnemonic-core/src/test/java/org/apache/mnemonic/ChunkBufferNGTest.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ public class ChunkBufferNGTest {
3131

3232
private long m_keyid = 22L;
3333
private volatile long m_checksum;
34+
private volatile long m_count;
3435
private int m_bufsize = 90 * 1024 * 1024;
3536

3637
@Test
@@ -55,7 +56,7 @@ public boolean reclaim(Long mres, Long sz) {
5556
long bufcnt = mch.getSize() / m_bufsize;
5657
ChunkBuffer ckbuf;
5758
byte[] rdbytes;
58-
for (int idx = 0; idx < bufcnt; ++idx) {
59+
for (long idx = 0; idx < bufcnt; ++idx) {
5960
// System.err.println(String.format("---- bufcnt: %d, bufsize: %d, idx: %d", bufcnt, m_bufsize, idx));
6061
ckbuf = mch.getChunkBuffer(idx * m_bufsize, m_bufsize);
6162
Assert.assertNotNull(ckbuf);
@@ -66,6 +67,7 @@ public boolean reclaim(Long mres, Long sz) {
6667
cs.update(rdbytes, 0, rdbytes.length);
6768
}
6869
m_checksum = cs.getValue();
70+
m_count = bufcnt;
6971
act.close();
7072
}
7173

@@ -90,7 +92,7 @@ public boolean reclaim(Long mres, Long sz) {
9092

9193
ChunkBuffer ckbuf;
9294
byte[] buf;
93-
for (int idx = 0; idx < bufcnt; ++idx) {
95+
for (long idx = 0; idx < bufcnt; ++idx) {
9496
ckbuf = mch.getChunkBuffer(idx * m_bufsize, m_bufsize);
9597
Assert.assertNotNull(ckbuf);
9698
buf = new byte[m_bufsize];
@@ -101,7 +103,8 @@ public boolean reclaim(Long mres, Long sz) {
101103
act.close();
102104

103105
Assert.assertEquals(m_checksum, cs.getValue());
104-
System.out.println(String.format("The checksum of chunk buffers are %d", m_checksum));
106+
Assert.assertEquals(m_count, bufcnt);
107+
System.out.println(String.format("The checksum of chunk buffers are %d, Total count is %d", m_checksum, m_count));
105108
}
106109

107110
}

0 commit comments

Comments
 (0)