to_float.c

v22.2b14/testsuite/single/tests/efuns/to_float.c · 264 B

From the archive beta.tar.gz

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