START_TEST(float_number)

{

    int i;

    struct {

        const char *encoded;

        double decoded;

        int skip;

    } test_cases[] = {

        { "32.43", 32.43 },

        { "0.222", 0.222 },

        { "-32.12313", -32.12313 },

        { "-32.20e-10", -32.20e-10, .skip = 1 },

        { },

    };



    for (i = 0; test_cases[i].encoded; i++) {

        QObject *obj;

        QFloat *qfloat;



        obj = qobject_from_json(test_cases[i].encoded);

        fail_unless(obj != NULL);

        fail_unless(qobject_type(obj) == QTYPE_QFLOAT);



        qfloat = qobject_to_qfloat(obj);

        fail_unless(qfloat_get_double(qfloat) == test_cases[i].decoded);



        if (test_cases[i].skip == 0) {

            QString *str;



            str = qobject_to_json(obj);

            fail_unless(strcmp(qstring_get_str(str), test_cases[i].encoded) == 0);

            QDECREF(str);

        }



        QDECREF(qfloat);

    }

}

START_TEST(float_number)

{

    int i;

    struct {

        const char *encoded;

        double decoded;

        int skip;

    } test_cases[] = {

        { "32.43", 32.43 },

        { "0.222", 0.222 },

        { "-32.12313", -32.12313 },

        { "-32.20e-10", -32.20e-10, .skip = 1 },

        { },

    };



    for (i = 0; test_cases[i].encoded; i++) {

        QObject *obj;

        QFloat *qfloat;



        obj = qobject_from_json(test_cases[i].encoded);

        fail_unless(obj != NULL);

        fail_unless(qobject_type(obj) == QTYPE_QFLOAT);



        qfloat = qobject_to_qfloat(obj);

        fail_unless(qfloat_get_double(qfloat) == test_cases[i].decoded);



        if (test_cases[i].skip == 0) {

            QString *str;



            str = qobject_to_json(obj);

            fail_unless(strcmp(qstring_get_str(str), test_cases[i].encoded) == 0);

            QDECREF(str);

        }



        QDECREF(qfloat);

    }

}

FUNC_0(VAR_0)

{

    int VAR_1;

    struct {

        const char *encoded;

        double decoded;

        int skip;

    } VAR_2[] = {

        { "32.43", 32.43 },

        { "0.222", 0.222 },

        { "-32.12313", -32.12313 },

        { "-32.20e-10", -32.20e-10, .skip = 1 },

        { },

    };



    for (VAR_1 = 0; VAR_2[VAR_1].encoded; VAR_1++) {

        QObject *obj;

        QFloat *qfloat;



        obj = qobject_from_json(VAR_2[VAR_1].encoded);

        fail_unless(obj != NULL);

        fail_unless(qobject_type(obj) == QTYPE_QFLOAT);



        qfloat = qobject_to_qfloat(obj);

        fail_unless(qfloat_get_double(qfloat) == VAR_2[VAR_1].decoded);



        if (VAR_2[VAR_1].skip == 0) {

            QString *str;



            str = qobject_to_json(obj);

            fail_unless(strcmp(qstring_get_str(str), VAR_2[VAR_1].encoded) == 0);

            QDECREF(str);

        }



        QDECREF(qfloat);

    }

}

FUNC_0(VAR_0)
{ int VAR_1; struct { const char *encoded; double decoded; int skip; } VAR_2[] = { { "32.43", 32.43 }, { "0.222", 0.222 }, { "-32.12313", -32.12313 }, { "-32.20e-10", -32.20e-10, .skip = 1 }, { }, }; for (VAR_1 = 0; VAR_2[VAR_1].encoded; VAR_1++) { QObject *obj; QFloat *qfloat; obj = qobject_from_json(VAR_2[VAR_1].encoded); fail_unless(obj != NULL); fail_unless(qobject_type(obj) == QTYPE_QFLOAT); qfloat = qobject_to_qfloat(obj); fail_unless(qfloat_get_double(qfloat) == VAR_2[VAR_1].decoded); if (VAR_2[VAR_1].skip == 0) { QString *str; str = qobject_to_json(obj); fail_unless(strcmp(qstring_get_str(str), VAR_2[VAR_1].encoded) == 0); QDECREF(str); } QDECREF(qfloat); } }