decimal tests
This commit is contained in:
parent
0f94a12252
commit
1ab8ee265c
|
@ -717,12 +717,9 @@ TEST(decimal, toStr) {
|
||||||
}
|
}
|
||||||
|
|
||||||
SDataType getDecimalType(uint8_t prec, uint8_t scale) {
|
SDataType getDecimalType(uint8_t prec, uint8_t scale) {
|
||||||
if (prec <= 18) {
|
if (prec > TSDB_DECIMAL_MAX_PRECISION) throw std::string("invalid prec: ") + std::to_string(prec);
|
||||||
return {.type = TSDB_DATA_TYPE_DECIMAL64, .precision = prec, .scale = scale, .bytes = 8};
|
uint8_t type = decimalTypeFromPrecision(prec);
|
||||||
} else if (prec <= 38) {
|
return {.type = type, .precision = prec, .scale = scale, .bytes = tDataTypes[type].bytes};
|
||||||
return {.type = TSDB_DATA_TYPE_DECIMAL, .precision = prec, .scale = scale, .bytes = 16};
|
|
||||||
}
|
|
||||||
return {};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator==(const SDataType& lt, const SDataType& rt) {
|
bool operator==(const SDataType& lt, const SDataType& rt) {
|
||||||
|
|
|
@ -30,7 +30,7 @@ ENDIF()
|
||||||
# ADD_EXECUTABLE(trefTest ./trefTest.c)
|
# ADD_EXECUTABLE(trefTest ./trefTest.c)
|
||||||
# TARGET_LINK_LIBRARIES(trefTest util common)
|
# TARGET_LINK_LIBRARIES(trefTest util common)
|
||||||
# ENDIF ()
|
# ENDIF ()
|
||||||
INCLUDE_DIRECTORIES(${TD_SOURCE_DIR}/src/util/inc)
|
INCLUDE_DIRECTORIES(${TD_SOURCE_DIR}/source/util/inc)
|
||||||
INCLUDE_DIRECTORIES(${TD_SOURCE_DIR}/include/common)
|
INCLUDE_DIRECTORIES(${TD_SOURCE_DIR}/include/common)
|
||||||
|
|
||||||
add_executable(heapTest "heapTest.cpp")
|
add_executable(heapTest "heapTest.cpp")
|
||||||
|
|
Loading…
Reference in New Issue