expr_test_utils: add make_float_* and make_double_*
Add utilities to create float and double values in tests. Signed-off-by: Jan Ciolek <jan.ciolek@scylladb.com>
This commit is contained in:
@@ -46,6 +46,14 @@ raw_value make_text_raw(const sstring_view& text) {
|
||||
return raw_value::make_value(utf8_type->decompose(text));
|
||||
}
|
||||
|
||||
raw_value make_float_raw(float val) {
|
||||
return make_raw(val);
|
||||
}
|
||||
|
||||
raw_value make_double_raw(double val) {
|
||||
return make_raw(val);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
constant make_const(T t) {
|
||||
data_type val_type = data_type_for<T>();
|
||||
@@ -80,6 +88,14 @@ constant make_text_const(const sstring_view& text) {
|
||||
return constant(make_text_raw(text), utf8_type);
|
||||
}
|
||||
|
||||
constant make_float_const(float val) {
|
||||
return make_const(val);
|
||||
}
|
||||
|
||||
constant make_double_const(double val) {
|
||||
return make_const(val);
|
||||
}
|
||||
|
||||
// This function implements custom serialization of collection values.
|
||||
// Some tests require the collection to contain an empty value,
|
||||
// which is impossible to express using the existing code.
|
||||
|
||||
@@ -30,6 +30,8 @@ raw_value make_smallint_raw(int16_t val);
|
||||
raw_value make_int_raw(int32_t val);
|
||||
raw_value make_bigint_raw(int64_t val);
|
||||
raw_value make_text_raw(const sstring_view& text);
|
||||
raw_value make_float_raw(float val);
|
||||
raw_value make_double_raw(double val);
|
||||
|
||||
constant make_empty_const(data_type type);
|
||||
constant make_bool_const(bool val);
|
||||
@@ -38,6 +40,8 @@ constant make_smallint_const(int16_t val);
|
||||
constant make_int_const(int32_t val);
|
||||
constant make_bigint_const(int64_t val);
|
||||
constant make_text_const(const sstring_view& text);
|
||||
constant make_float_const(float val);
|
||||
constant make_double_const(double val);
|
||||
|
||||
// This function implements custom serialization of collection values.
|
||||
// Some tests require the collection to contain unset_value or an empty value,
|
||||
|
||||
Reference in New Issue
Block a user