use of io.qameta.allure.Issue in project atsd-api-test by axibase.
the class CastTest method testCastNumberAsStringApplied.
@Issue("3770")
@Test(dataProvider = "castNumberArgumentsProvider")
public void testCastNumberAsStringApplied(String castArgument) throws Exception {
Series series = castNumberAsStringSeries;
String sqlQuery = String.format("SELECT CAST(%s AS string) FROM \"%s\"", castArgument, series.getMetric());
StringTable resultTable = SqlMethod.queryTable(sqlQuery);
assertEquals("Bad column type for CAST as string column", "string", resultTable.getColumnMetaData(0).getDataType());
}
use of io.qameta.allure.Issue in project atsd-api-test by axibase.
the class CastTest method testCastNumberAsStringPassedToStringFunction.
@Issue("3770")
@Test(dataProvider = "castNumberArgumentsProvider")
public void testCastNumberAsStringPassedToStringFunction(String castArgument) throws Exception {
Series series = castNumberAsStringSeries;
String sqlQuery = String.format("SELECT CONCAT('foo', CAST(%s AS string)) FROM \"%s\"", castArgument, series.getMetric());
StringTable resultTable = SqlMethod.queryTable(sqlQuery);
assertEquals("'foo' has not been concatenated with casted number", "foo", resultTable.getValueAt(0, 0).substring(0, 3));
}
use of io.qameta.allure.Issue in project atsd-api-test by axibase.
the class CastTest method testCastConstantAsStringAppliesFormat.
@Issue("3770")
@Test(dataProvider = "constNumbersWithFormatProvider")
public void testCastConstantAsStringAppliesFormat(String castArgument, String expected) throws Exception {
/**
* Proper format of number is #.##
*/
Series series = castNumberAsStringSeries;
String sqlQuery = String.format("SELECT CAST(%s AS string) FROM \"%s\"", castArgument, series.getMetric());
StringTable resultTable = SqlMethod.queryTable(sqlQuery);
String castValue = resultTable.getValueAt(0, 0);
assertEquals("Inproper format applied", expected, castValue);
}
use of io.qameta.allure.Issue in project atsd-api-test by axibase.
the class CastTest method testImplicitCastToNumberInFunction.
@Issue("4020")
@Test
public void testImplicitCastToNumberInFunction() throws Exception {
Series series = Mocks.series();
SeriesMethod.insertSeriesCheck(series);
String sql = String.format("SELECT ABS('10')%n" + "FROM \"%s\"", series.getMetric());
String[][] expected = { { "10" } };
assertSqlQueryRows("String constant argument was not implicitly casted to number", expected, sql);
}
use of io.qameta.allure.Issue in project atsd-api-test by axibase.
the class CastTest method testImplicitCastOfStringFunctionResult.
@Issue("4020")
@Test
public void testImplicitCastOfStringFunctionResult() throws Exception {
Series series = Mocks.series();
series.setSamples(Collections.singletonList(Sample.ofDateInteger(Mocks.ISO_TIME, 10)));
SeriesMethod.insertSeriesCheck(series);
String sql = String.format("SELECT ABS(CONCAT(value, ''))%n" + "FROM \"%s\"", series.getMetric());
String[][] expected = { { "10" } };
assertSqlQueryRows("String function result was not implicitly casted to number", expected, sql);
}
Aggregations