to_float.c

ds2.10/fluffos-2.16-ds05/testsuite/single/tests/efuns/to_float.c · 260 B

From the archive ds2.10.zip

Download the archive   « Back to the archive contents

inherit "/inherit/tests";

void do_tests() {
    int i = 5;
    float f = 6.7;

    f = to_float(i);
    ASSERT(f == 5.0);

    f = i;
    ASSERT(f == 5.0);

    f = to_float("1.23");
    ASSERT(f == 1.23);

    f = to_float("ajdfj");
    ASSERT(f == 0.00);
}

Site Stats

Snippets: 1791
Codebases: 571