MCPcopy Create free account
hub / github.com/BaseXdb/basex / run

Method run

basex-core/src/test/java/org/basex/util/InlineTest.java:83–102  ·  view source on GitHub ↗

Tests the correctness of the compressed tokens. @param string test string

(final String string)

Source from the content-addressed store, hash-verified

81 * @param string test string
82 */
83 private static void run(final String string) {
84 final byte[] token = token(string);
85 final long packed = Inline.pack(token);
86 if(packed == 0) fail("Value could not be inlined: " + string);
87
88 final byte[] unpacked = Inline.unpack(packed);
89 if(!eq(token, unpacked)) {
90 final StringBuilder sb = new StringBuilder();
91 sb.append("\nInput: ").append(string);
92 sb.append("\nExpected: ").append(Arrays.toString(token));
93 sb.append("\nFound: ").append(Arrays.toString(unpacked));
94 sb.append("\nInlined Value:\n");
95 for(int i = 32; i >= 0; i -= 8) {
96 final StringBuilder bin = new StringBuilder(Long.toBinaryString(packed >> i & 0xFF));
97 while(bin.length() < 8) bin.insert(0, '0');
98 sb.append(bin).append("\n");
99 }
100 fail(sb.toString());
101 }
102 }
103
104 /**
105 * Tokens to be rejected.

Callers 3

inlineIntegerMethod · 0.95
inlineTokenMethod · 0.95
inlineWhitespaceMethod · 0.95

Calls 8

packMethod · 0.95
unpackMethod · 0.95
tokenMethod · 0.65
eqMethod · 0.65
appendMethod · 0.65
toStringMethod · 0.65
insertMethod · 0.65
lengthMethod · 0.45

Tested by

no test coverage detected