to_int.c

v22.2b14/testsuite/single/tests/efuns/to_int.c · 218 B

From the archive beta.tar.gz

Download the archive   « Back to the archive contents

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

    i = f;
    ASSERT(i == 6);

    i = to_int("7");
    ASSERT(i == 7);

    i = to_int("ajdfj");
    ASSERT(i == 0);
}

Site Stats

Snippets: 1791
Codebases: 571