use of com.questdb.std.str.StringSink in project questdb by bluestreak01.
the class LexerTest method testSymbolLookup.
@Test
public void testSymbolLookup() {
Lexer ts = new Lexer();
ts.defineSymbol("+");
ts.defineSymbol("++");
ts.defineSymbol("*");
CharSequence content;
ts.setContent(content = "+*a+b++blah-");
StringSink sink = new StringSink();
for (CharSequence cs : ts) {
sink.put(cs);
}
TestUtils.assertEquals(content, sink);
}
use of com.questdb.std.str.StringSink in project questdb by bluestreak01.
the class LexerTest method testQuotedToken.
@Test
public void testQuotedToken() {
Lexer ts = new Lexer();
ts.defineSymbol("+");
ts.defineSymbol("++");
ts.defineSymbol("*");
ts.setContent("a+\"b\"*abc");
StringSink sink = new StringSink();
for (CharSequence cs : ts) {
sink.put(cs);
}
TestUtils.assertEquals("a+\"b\"*abc", sink);
}
use of com.questdb.std.str.StringSink in project questdb by bluestreak01.
the class LexerTest method testEdgeSymbol.
@Test
public void testEdgeSymbol() {
Lexer ts = new Lexer();
ts.defineSymbol(" ");
ts.defineSymbol("+");
ts.defineSymbol("(");
ts.defineSymbol(")");
ts.defineSymbol(",");
CharSequence content;
ts.setContent(content = "create journal xyz(a int, b int)");
StringSink sink = new StringSink();
for (CharSequence cs : ts) {
sink.put(cs);
}
TestUtils.assertEquals(content, sink);
}
use of com.questdb.std.str.StringSink in project questdb by bluestreak01.
the class TxLogTest method testTxLogIterator.
@Test
public void testTxLogIterator() throws Exception {
try (JournalWriter<Quote> w = getFactory().writer(Quote.class)) {
for (int i = 0; i < 10; i++) {
TestUtils.generateQuoteData(w, 100, w.getMaxTimestamp());
w.commit();
}
final String expected = "10\t0\t1000\n" + "9\t0\t900\n" + "8\t0\t800\n" + "7\t0\t700\n" + "6\t0\t600\n" + "5\t0\t500\n" + "4\t0\t400\n" + "3\t0\t300\n" + "2\t0\t200\n" + "1\t0\t100\n" + "0\t0\t0\n";
DelimitedCharSink sink = new DelimitedCharSink(new StringSink(), '\t', "\n");
for (Tx tx : w.transactions()) {
sink.put(tx.txn);
sink.put(tx.journalMaxRowID == -1 ? 0 : Rows.toPartitionIndex(tx.journalMaxRowID));
sink.put(tx.journalMaxRowID == -1 ? 0 : Rows.toLocalRowID(tx.journalMaxRowID));
sink.eol();
}
sink.flush();
Assert.assertEquals(expected, sink.toString());
}
}
use of com.questdb.std.str.StringSink in project questdb by bluestreak01.
the class IntHashSet method toString.
@Override
public String toString() {
StringSink sink = new StringSink();
toString(sink);
return sink.toString();
}
Aggregations