use of com.google.cloud.spanner.pgadapter.parsers.NumericParser in project pgadapter by GoogleCloudPlatform.
the class ParserTest method testNumericParsing.
@Test
public void testNumericParsing() {
BigDecimal value = new BigDecimal("1234567890.1234567890");
byte[] byteResult = ByteConverter.numeric(new BigDecimal("1234567890.1234567890"));
byte[] stringResult = { '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '.', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0' };
Parser parser = new NumericParser(value);
validate(parser, byteResult, stringResult, stringResult);
assertThat(parser.getItem(), is(equalTo(value)));
validateCreateBinary(byteResult, Oid.NUMERIC, value);
validateCreateText(stringResult, Oid.NUMERIC, value);
}
use of com.google.cloud.spanner.pgadapter.parsers.NumericParser in project pgadapter by GoogleCloudPlatform.
the class ParserTest method testNumericParsingNaN.
@Test
public void testNumericParsingNaN() {
Number value = Double.NaN;
byte[] stringResult = { 'N', 'a', 'N' };
NumericParser parser = new NumericParser(value);
validate(parser, stringResult, stringResult, stringResult);
assertThat(parser.getItem(), is(equalTo(value)));
validateCreateText(stringResult, Oid.NUMERIC, value);
}
Aggregations