Search in sources :

Example 1 with LongParser

use of com.google.cloud.spanner.pgadapter.parsers.LongParser in project pgadapter by GoogleCloudPlatform.

the class ParserTest method testPositiveLongParsing.

@Test
public void testPositiveLongParsing() {
    long value = 1234567890L;
    byte[] byteResult = { 0, 0, 0, 0, 73, -106, 2, -46 };
    byte[] stringResult = { '1', '2', '3', '4', '5', '6', '7', '8', '9', '0' };
    Parser parsedValue = new LongParser(value);
    validate(parsedValue, byteResult, stringResult, stringResult);
    validateCreateBinary(byteResult, Oid.INT8, value);
    validateCreateText(stringResult, Oid.INT8, value);
}
Also used : LongParser(com.google.cloud.spanner.pgadapter.parsers.LongParser) DoubleParser(com.google.cloud.spanner.pgadapter.parsers.DoubleParser) StatementParser(com.google.cloud.spanner.pgadapter.utils.StatementParser) ArrayParser(com.google.cloud.spanner.pgadapter.parsers.ArrayParser) BooleanParser(com.google.cloud.spanner.pgadapter.parsers.BooleanParser) NumericParser(com.google.cloud.spanner.pgadapter.parsers.NumericParser) StringParser(com.google.cloud.spanner.pgadapter.parsers.StringParser) BinaryParser(com.google.cloud.spanner.pgadapter.parsers.BinaryParser) Parser(com.google.cloud.spanner.pgadapter.parsers.Parser) IntegerParser(com.google.cloud.spanner.pgadapter.parsers.IntegerParser) CopyTreeParser(com.google.cloud.spanner.pgadapter.parsers.copy.CopyTreeParser) LongParser(com.google.cloud.spanner.pgadapter.parsers.LongParser) DateParser(com.google.cloud.spanner.pgadapter.parsers.DateParser) TimestampParser(com.google.cloud.spanner.pgadapter.parsers.TimestampParser) Test(org.junit.Test)

Example 2 with LongParser

use of com.google.cloud.spanner.pgadapter.parsers.LongParser in project pgadapter by GoogleCloudPlatform.

the class ParserTest method testNegativeLongParsing.

@Test
public void testNegativeLongParsing() {
    long value = -1234567890L;
    byte[] byteResult = { -1, -1, -1, -1, -74, 105, -3, 46 };
    byte[] stringResult = { '-', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0' };
    Parser parsedValue = new LongParser(value);
    validate(parsedValue, byteResult, stringResult, stringResult);
    validateCreateBinary(byteResult, Oid.INT8, value);
    validateCreateText(stringResult, Oid.INT8, value);
}
Also used : LongParser(com.google.cloud.spanner.pgadapter.parsers.LongParser) DoubleParser(com.google.cloud.spanner.pgadapter.parsers.DoubleParser) StatementParser(com.google.cloud.spanner.pgadapter.utils.StatementParser) ArrayParser(com.google.cloud.spanner.pgadapter.parsers.ArrayParser) BooleanParser(com.google.cloud.spanner.pgadapter.parsers.BooleanParser) NumericParser(com.google.cloud.spanner.pgadapter.parsers.NumericParser) StringParser(com.google.cloud.spanner.pgadapter.parsers.StringParser) BinaryParser(com.google.cloud.spanner.pgadapter.parsers.BinaryParser) Parser(com.google.cloud.spanner.pgadapter.parsers.Parser) IntegerParser(com.google.cloud.spanner.pgadapter.parsers.IntegerParser) CopyTreeParser(com.google.cloud.spanner.pgadapter.parsers.copy.CopyTreeParser) LongParser(com.google.cloud.spanner.pgadapter.parsers.LongParser) DateParser(com.google.cloud.spanner.pgadapter.parsers.DateParser) TimestampParser(com.google.cloud.spanner.pgadapter.parsers.TimestampParser) Test(org.junit.Test)

Aggregations

ArrayParser (com.google.cloud.spanner.pgadapter.parsers.ArrayParser)2 BinaryParser (com.google.cloud.spanner.pgadapter.parsers.BinaryParser)2 BooleanParser (com.google.cloud.spanner.pgadapter.parsers.BooleanParser)2 DateParser (com.google.cloud.spanner.pgadapter.parsers.DateParser)2 DoubleParser (com.google.cloud.spanner.pgadapter.parsers.DoubleParser)2 IntegerParser (com.google.cloud.spanner.pgadapter.parsers.IntegerParser)2 LongParser (com.google.cloud.spanner.pgadapter.parsers.LongParser)2 NumericParser (com.google.cloud.spanner.pgadapter.parsers.NumericParser)2 Parser (com.google.cloud.spanner.pgadapter.parsers.Parser)2 StringParser (com.google.cloud.spanner.pgadapter.parsers.StringParser)2 TimestampParser (com.google.cloud.spanner.pgadapter.parsers.TimestampParser)2 CopyTreeParser (com.google.cloud.spanner.pgadapter.parsers.copy.CopyTreeParser)2 StatementParser (com.google.cloud.spanner.pgadapter.utils.StatementParser)2 Test (org.junit.Test)2