@Test public void decimalStringWithManyLeadingZeros() throws IOException { assertLongDecimalString("00000000000000001", 1); assertLongDecimalString("00000000000000009223372036854775807", 9223372036854775807L); assertLongDecimalString("-00000000000000009223372036854775808", -9223372036854775808L); assertLongDecimalString(TestUtil.repeat('0', Segment.SIZE + 1) + "1", 1); }
@Test public void hexStringWithManyLeadingZeros() throws IOException { assertLongHexString("00000000000000001", 0x1); assertLongHexString("0000000000000000ffffffffffffffff", 0xffffffffffffffffL); assertLongHexString("00000000000000007fffffffffffffff", 0x7fffffffffffffffL); assertLongHexString(TestUtil.repeat('0', Segment.SIZE + 1) + "1", 0x1); }
@Test public void writeAllWritesOneSegmentAtATime() throws IOException { Buffer write1 = new Buffer().writeUtf8(TestUtil.repeat('a', Segment.SIZE)); Buffer write2 = new Buffer().writeUtf8(TestUtil.repeat('b', Segment.SIZE)); Buffer write3 = new Buffer().writeUtf8(TestUtil.repeat('c', Segment.SIZE)); Buffer source = new Buffer() .writeUtf8( "" + TestUtil.repeat('a', Segment.SIZE) + TestUtil.repeat('b', Segment.SIZE) + TestUtil.repeat('c', Segment.SIZE)); MockSink mockSink = new MockSink(); BufferedSink bufferedSink = Okio.buffer(mockSink); assertEquals(Segment.SIZE * 3, bufferedSink.writeAll(source)); mockSink.assertLog( "write(" + write1 + ", " + write1.size() + ")", "write(" + write2 + ", " + write2.size() + ")", "write(" + write3 + ", " + write3.size() + ")"); }