MCPcopy Create free account
hub / github.com/alibaba/MNN / TestSizedInputStream

Method TestSizedInputStream

3rd_party/flatbuffers/tests/JavaTest.java:253–275  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

251 }
252
253 static void TestSizedInputStream() {
254 // Test on default FlatBufferBuilder that uses HeapByteBuffer
255 FlatBufferBuilder fbb = new FlatBufferBuilder(1);
256
257 TestBuilderBasics(fbb, false);
258
259 InputStream in = fbb.sizedInputStream();
260 byte[] array = fbb.sizedByteArray();
261 int count = 0;
262 int currentVal = 0;
263
264 while (currentVal != -1 && count < array.length) {
265 try {
266 currentVal = in.read();
267 } catch(java.io.IOException e) {
268 System.out.println("FlatBuffers test: couldn't read from InputStream");
269 return;
270 }
271 TestEq((byte)currentVal, array[count]);
272 count++;
273 }
274 TestEq(count, array.length);
275 }
276
277 static void TestBuilderBasics(FlatBufferBuilder fbb, boolean sizePrefix) {
278 int[] names = {fbb.createString("Frodo"), fbb.createString("Barney"), fbb.createString("Wilma")};

Callers 1

mainMethod · 0.95

Calls 3

TestBuilderBasicsMethod · 0.95
TestEqMethod · 0.95
readMethod · 0.45

Tested by

no test coverage detected