build: re-enable namespace-specific tests
This commit is contained in:
@@ -1,9 +1,12 @@
|
||||
#include <fx/ds/array.h>
|
||||
#include <fx/ds/datetime.h>
|
||||
#include <fx/ds/dict.h>
|
||||
#include <fx/ds/number.h>
|
||||
#include <fx/ds/string.h>
|
||||
#include <fx/serial.h>
|
||||
#include <fx/bool.h>
|
||||
#include <fx/collections/array.h>
|
||||
#include <fx/collections/datetime.h>
|
||||
#include <fx/collections/dict.h>
|
||||
#include <fx/double.h>
|
||||
#include <fx/int.h>
|
||||
#include <fx/serial/ctx.h>
|
||||
#include <fx/serial/toml.h>
|
||||
#include <fx/string.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
void write_tagged_value(fx_object *data);
|
||||
@@ -50,50 +53,50 @@ void write_tagged_string(fx_string *data)
|
||||
fx_stream_write_cstr(fx_stdout, " }", NULL);
|
||||
}
|
||||
|
||||
void write_tagged_integer(fx_number *data)
|
||||
void write_tagged_integer(fx_int *data)
|
||||
{
|
||||
fx_stream_write_cstr(
|
||||
fx_stdout,
|
||||
"{ \"type\": \"integer\", \"value\": \"",
|
||||
NULL);
|
||||
|
||||
if (fx_number_is_inf_positive(data)) {
|
||||
if (fx_int_is_inf_positive(data)) {
|
||||
fx_stream_write_cstr(fx_stdout, "inf", NULL);
|
||||
} else if (fx_number_is_inf_negative(data)) {
|
||||
} else if (fx_int_is_inf_negative(data)) {
|
||||
fx_stream_write_cstr(fx_stdout, "-inf", NULL);
|
||||
} else if (fx_number_is_nan_positive(data)) {
|
||||
} else if (fx_int_is_nan_positive(data)) {
|
||||
fx_stream_write_cstr(fx_stdout, "nan", NULL);
|
||||
} else if (fx_number_is_nan_negative(data)) {
|
||||
} else if (fx_int_is_nan_negative(data)) {
|
||||
fx_stream_write_cstr(fx_stdout, "-nan", NULL);
|
||||
} else {
|
||||
fx_stream_write_fmt(
|
||||
fx_stdout,
|
||||
NULL,
|
||||
"%lld",
|
||||
fx_number_get_longlong(data),
|
||||
fx_int_get_value(data),
|
||||
NULL);
|
||||
}
|
||||
|
||||
fx_stream_write_cstr(fx_stdout, "\" }", NULL);
|
||||
}
|
||||
|
||||
void write_tagged_float(fx_number *data)
|
||||
void write_tagged_float(fx_double *data)
|
||||
{
|
||||
fx_stream_write_cstr(
|
||||
fx_stdout,
|
||||
"{ \"type\": \"float\", \"value\": \"",
|
||||
NULL);
|
||||
|
||||
if (fx_number_is_inf_positive(data)) {
|
||||
if (fx_double_is_inf_positive(data)) {
|
||||
fx_stream_write_cstr(fx_stdout, "inf", NULL);
|
||||
} else if (fx_number_is_inf_negative(data)) {
|
||||
} else if (fx_double_is_inf_negative(data)) {
|
||||
fx_stream_write_cstr(fx_stdout, "-inf", NULL);
|
||||
} else if (fx_number_is_nan_positive(data)) {
|
||||
} else if (fx_double_is_nan_positive(data)) {
|
||||
fx_stream_write_cstr(fx_stdout, "nan", NULL);
|
||||
} else if (fx_number_is_nan_negative(data)) {
|
||||
} else if (fx_double_is_nan_negative(data)) {
|
||||
fx_stream_write_cstr(fx_stdout, "-nan", NULL);
|
||||
} else {
|
||||
double v = fx_number_get_double(data);
|
||||
double v = fx_double_get_value(data);
|
||||
if ((v <= 0.00000001 && v > 0) || (v >= -0.00000001 && v < 0)
|
||||
|| (v >= 1000000000) || (v <= -1000000000)) {
|
||||
fx_stream_write_fmt(fx_stdout, NULL, "%.15e", v, NULL);
|
||||
@@ -105,14 +108,13 @@ void write_tagged_float(fx_number *data)
|
||||
fx_stream_write_cstr(fx_stdout, "\" }", NULL);
|
||||
}
|
||||
|
||||
void write_tagged_bool(fx_number *data)
|
||||
void write_tagged_bool(fx_bool *data)
|
||||
{
|
||||
int v = fx_number_get_int8(data);
|
||||
fx_stream_write_fmt(
|
||||
fx_stdout,
|
||||
NULL,
|
||||
"{ \"type\": \"bool\", \"value\": \"%s\" }",
|
||||
(v > 0) ? "true" : "false",
|
||||
fx_bool_get_value(data) ? "true" : "false",
|
||||
NULL);
|
||||
}
|
||||
|
||||
@@ -197,30 +199,18 @@ void write_tagged_value(fx_object *data)
|
||||
{
|
||||
if (fx_object_is_type(data, FX_TYPE_DICT)) {
|
||||
write_tagged_dict(data);
|
||||
|
||||
} else if (fx_object_is_type(data, FX_TYPE_ARRAY)) {
|
||||
write_tagged_array(data);
|
||||
|
||||
} else if (fx_object_is_type(data, FX_TYPE_STRING)) {
|
||||
write_tagged_string(data);
|
||||
|
||||
} else if (fx_object_is_type(data, FX_TYPE_DATETIME)) {
|
||||
write_tagged_datetime(data);
|
||||
|
||||
} else if (fx_object_is_type(data, FX_TYPE_NUMBER)) {
|
||||
switch (fx_number_get_number_type(data)) {
|
||||
case FX_NUMBER_LONGLONG:
|
||||
write_tagged_integer(data);
|
||||
break;
|
||||
case FX_NUMBER_INT8:
|
||||
write_tagged_bool(data);
|
||||
break;
|
||||
case FX_NUMBER_DOUBLE:
|
||||
write_tagged_float(data);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} else if (fx_object_is_type(data, FX_TYPE_INT)) {
|
||||
write_tagged_integer(data);
|
||||
} else if (fx_object_is_type(data, FX_TYPE_BOOL)) {
|
||||
write_tagged_bool(data);
|
||||
} else if (fx_object_is_type(data, FX_TYPE_DOUBLE)) {
|
||||
write_tagged_float(data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user