Search in sources :

Example 21 with StringSink

use of com.questdb.std.str.StringSink in project questdb by bluestreak01.

the class Lexer2Test method testQuotedToken.

@Test
public void testQuotedToken() {
    Lexer2 ts = new Lexer2();
    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);
}
Also used : DirectByteCharSequence(com.questdb.std.str.DirectByteCharSequence) StringSink(com.questdb.std.str.StringSink) Test(org.junit.Test)

Example 22 with StringSink

use of com.questdb.std.str.StringSink in project questdb by bluestreak01.

the class Lexer2Test method testSymbolLookup.

@Test
public void testSymbolLookup() {
    Lexer2 ts = new Lexer2();
    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);
}
Also used : DirectByteCharSequence(com.questdb.std.str.DirectByteCharSequence) StringSink(com.questdb.std.str.StringSink) Test(org.junit.Test)

Example 23 with StringSink

use of com.questdb.std.str.StringSink in project questdb by bluestreak01.

the class LexerTest method testSingleQuotedToken.

@Test
public void testSingleQuotedToken() {
    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);
}
Also used : DirectByteCharSequence(com.questdb.std.str.DirectByteCharSequence) StringSink(com.questdb.std.str.StringSink) Test(org.junit.Test)

Example 24 with StringSink

use of com.questdb.std.str.StringSink in project questdb by bluestreak01.

the class LexerTest method testBlockComments.

@Test
public void testBlockComments() {
    Lexer lex = new Lexer();
    lex.defineSymbol("+");
    lex.defineSymbol("++");
    lex.defineSymbol("*");
    lex.defineSymbol("/*");
    lex.defineSymbol("*/");
    lex.setContent("a + /* ok, this /* is a */ comment */ 'b' * abc");
    StringSink sink = new StringSink();
    while (lex.hasNext()) {
        sink.put(lex.optionTok());
    }
    TestUtils.assertEquals("a+'b'*abc", sink);
}
Also used : StringSink(com.questdb.std.str.StringSink) Test(org.junit.Test)

Example 25 with StringSink

use of com.questdb.std.str.StringSink in project questdb by bluestreak01.

the class LexerTest method testLineComment.

@Test
public void testLineComment() {
    Lexer lex = new Lexer();
    lex.defineSymbol("+");
    lex.defineSymbol("++");
    lex.defineSymbol("*");
    lex.defineSymbol("/*");
    lex.defineSymbol("*/");
    lex.defineSymbol("--");
    lex.setContent("a + -- ok, this is a comment \n 'b' * abc");
    StringSink sink = new StringSink();
    while (lex.hasNext()) {
        sink.put(lex.optionTok());
    }
    TestUtils.assertEquals("a+'b'*abc", sink);
}
Also used : StringSink(com.questdb.std.str.StringSink) Test(org.junit.Test)

Aggregations

StringSink (com.questdb.std.str.StringSink)52 Test (org.junit.Test)35 RecordSourcePrinter (com.questdb.ql.RecordSourcePrinter)14 BootstrapEnv (com.questdb.BootstrapEnv)11 ServerConfiguration (com.questdb.ServerConfiguration)11 DirectByteCharSequence (com.questdb.std.str.DirectByteCharSequence)10 AbstractJournalTest (com.questdb.net.ha.AbstractJournalTest)9 ImportHandler (com.questdb.net.http.handlers.ImportHandler)9 QueryCompiler (com.questdb.parser.sql.QueryCompiler)9 AbstractTest (com.questdb.test.tools.AbstractTest)7 RecordSource (com.questdb.ql.RecordSource)5 Rnd (com.questdb.std.Rnd)5 CountDownLatch (java.util.concurrent.CountDownLatch)5 Album (com.questdb.model.Album)4 Band (com.questdb.model.Band)4 SelectedColumnsRecordSource (com.questdb.ql.select.SelectedColumnsRecordSource)4 JournalEntryWriter (com.questdb.store.JournalEntryWriter)4 RecordColumnMetadata (com.questdb.common.RecordColumnMetadata)3 RecordCursor (com.questdb.common.RecordCursor)3 Quote (com.questdb.model.Quote)3