Skip to content

Commit a5b82c2

Browse files
committed
[test] Wrote UInt8 buffer int list testing class
1 parent 0d1591c commit a5b82c2

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/*
2+
* Copyright (C) 2018 Muhammad Tayyab Akram
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.mta.tehreer.internal.collections;
18+
19+
import com.mta.tehreer.collections.IntListTestSuite;
20+
import com.mta.tehreer.internal.Memory;
21+
22+
import org.junit.After;
23+
import org.junit.Before;
24+
25+
import java.nio.ByteBuffer;
26+
27+
public class UInt8BufferIntListTest extends IntListTestSuite {
28+
private long pointer;
29+
30+
@Before
31+
public void setUp() {
32+
byte[] sample = new byte[] {
33+
(byte) 0x00, (byte) 0x1C, (byte) 0x38, (byte) 0x54, (byte) 0x70,
34+
(byte) 0x8C, (byte) 0xA8, (byte) 0xC4, (byte) 0xE0, (byte) 0xFC
35+
};
36+
37+
this.pointer = Memory.allocate(sample.length);
38+
this.expected = new int[] { 0x00, 0x1C, 0x38, 0x54, 0x70, 0x8C, 0xA8, 0xC4, 0xE0, 0xFC };
39+
this.actual = new UInt8BufferIntList(null, pointer, sample.length);
40+
41+
ByteBuffer buffer = Memory.buffer(pointer, sample.length);
42+
buffer.put(sample);
43+
}
44+
45+
@After
46+
public void tearDown() {
47+
Memory.dispose(pointer);
48+
}
49+
}

0 commit comments

Comments
 (0)