StratifyLabs / sostest

Stratify OS Test Suite
GNU Lesser General Public License v3.0
3 stars 3 forks source link

Add additional test cases to num_test.c #2

Open tyler-gilbert opened 6 years ago

tyler-gilbert commented 6 years ago

Every operator should test every corner case.

For example, mul_f should try HUGE_VALF with positive and negative and by 0.0f. Also, some random numbers both positive and negative should be test.

tyler-gilbert commented 6 years ago

@shomagan

I received your pull request. This is the next issue to start working on.

The idea of this issue is to test many options for every operation. So greater then zero less than zero, equal to zero, HUGE_VAL, INFINITY, NAN, and every combination in between.

tyler-gilbert commented 6 years ago

@shomagan

The div and mod functions for 64 bit (div_u64, div_s64, modulus_u64, modulus_s64) values are failing. Maybe there is an obvious reason for that. Or maybe libgcc just doesn't handle those correctly. I will create a new issue for that.

We want more test cases. Once example might be then mul_f hits an overflow condition (multiply two large but valid numbers). Does that work?

We also want more casting cases like:

    TEST_CASE_CAST(f_to_int, op_f, op_int, 0.4f),
    TEST_CASE_CAST(f_to_int, op_f, op_int, -1.1f),
    TEST_CASE_CAST(f_to_int, op_f, op_int, HUGE_VALF),
    TEST_CASE_CAST(f_to_int, op_f, op_int, -8.06f), //a bunch of just random number cases
    TEST_CASE_CAST(f_to_int, op_f, op_int, INFINITY),

Then we need additional cases for f_to_s64, f_to_u64, f_to_s32, f_to_u32, f_to_int.

FYI. This is the program output.

Start int tests
test <...passed
test <=...passed
test >...passed
test >=...passed
test ==...passed
test !=...passed
test *...passed
test /...passed
test +...passed
test -...passed
Start float tests
done
test <...passed
test <=...passed
test >...passed
test >=...passed
test ==...passed
test !=...passed
test *...passed
test /...test +...passed
test -...passed
test cmp_f 1.0f==1.0f...passed
test cmp_f 1234.567f==765.4321f...passed
test cmp_f -123.0f==-768.0f...passed
test cmp_f 0.0f==-0.0f...passed
test cmp_f 1.0f==NAN...passed
test cmp_f NAN==1.0f...passed
test cmp_f NAN==NAN...passed
test cmp_f INFINITY==1.0f...passed
test cmp_f 0.0f==INFINITY...passed
test cmp_f -INFINITY==0.0f...passed
test cmp_f 0.0f==-INFINITY...passed
test cmp_f INFINITY==INFINITY...passed
test cmp_f -INFINITY==-INFINITY...passed
test cmp_f INFINITY==-INFINITY...passed
test cmp_f -INFINITY==INFINITY...passed
test cmp_f -INFINITY==INFINITY...passed
test cmp_f 0.0f==HUGE_VAL...passed
test cmp_f 0.0f==-HUGE_VAL...passed
test cmp_f 0.0f==NAN...passed
test cmp_f -0.0f==HUGE_VAL...passed
test cmp_f -0.0f==-HUGE_VAL...passed
test cmp_f -0.0f==NAN...passed
test cmp_f NAN==HUGE_VAL...passed
test cmp_f NAN==-HUGE_VAL...passed
test cmp_f NAN==3.14159f...passed
test cmp_f NAN==3.14159f...passed
test cmp_f INFINITY==NAN...passed
test cmp_f -INFINITY==NAN...passed
test cmp_f INFINITY==HUGE_VAL...passed
test cmp_f -INFINITY==HUGE_VAL...passed
test cmp_f INFINITY==-HUGE_VAL...passed
test cmp_f -INFINITY==-HUGE_VAL...passed
test cmp_f 86400.0f==-HUGE_VAL...passed
test cmp_f 86400.0f==HUGE_VAL...passed
test cmp_f -86400.0f==HUGE_VAL...passed
test mul_f 1.0f*HUGE_VALF...passed
test mul_f -1.0f*HUGE_VALF...passed
test mul_f 1.0f*-HUGE_VALF...passed
test mul_f HUGE_VALF*INFINITY...passed
test mul_f HUGE_VALF*-INFINITY...passed
test mul_f -HUGE_VALF*-INFINITY...passed
test mul_f -HUGE_VALF*INFINITY...passed
test mul_f -2.25*HUGE_VALF...passed
test mul_f HUGE_VALF*12...passed
test mul_f 0.5f*10.0f...passed
test mul_f -0.5f*-2.0f...passed
test mul_f HUGE_VALF*0.25f...passed
test mul_f -0.125f*HUGE_VALF...passed
test mul_f 0.0f*-0.0f...passed
test mul_f 0.0f*1440.0f...passed
test mul_f -0.0f*1440.0f...passed
test mul_f -1440.0f*0.0f...passed
test mul_f 3.14159f*INFINITY...passed
test mul_f 3.14159f*-INFINITY...passed
test div_f 0.0f/HUGE_VALF...passed
test div_f 1.0f/HUGE_VALF...passed
test div_f -1.0f/HUGE_VALF...passed
test div_f 1.0f/-HUGE_VALF...passed
test div_f -2.25/HUGE_VALF...passed
test div_f HUGE_VALF/1.0f...passed
test div_f HUGE_VALF/-1.0f...passed
test div_f -HUGE_VALF/1.0f...passed
test div_f HUGE_VALF/-2.25...passed
test div_f 0.5f/10.0f...passed
test div_f -0.5f/-2.0f...passed
test div_f HUGE_VALF/0.25f...passed
test div_f -0.125f/HUGE_VALF...passed
test div_f 1.0f/1.0f...passed
test div_f 3.14159f/INFINITY...passed
test div_f 3.14159f/-INFINITY...passed
test div_f 3.14159f/3.14159f...passed
test mul_u64 100ULL*100ULL...passed
test div_u64 100ULL/100ULL...134599273 != -1...failed
test cmp_u64 100ULL==100ULL...passed
test sub_u64 100ULL-100ULL...passed
test add_u64 100ULL+100ULL...passed
test modulus_u64 100ULL%100ULL...134599273 != 100...failed
test greaterthan_u64 100ULL>100ULL...passed
test greaterthanorequal_u64 100ULL>=100ULL...passed
test lessthan_u64 100ULL<100ULL...passed
test lessthanorequal_u64 100ULL<=100ULL...passed
test mul_s64 100ULL*100ULL...passed
test div_s64 100ULL/100ULL...134599273 != 2147483647...failed
test cmp_s64 100ULL==100ULL...passed
test sub_s64 100ULL-100ULL...passed
test add_s64 100ULL+100ULL...passed
test modulus_s64 100ULL%100ULL...134599273 != 100...failed
test greaterthan_s64 100ULL>100ULL...passed
test greaterthanorequal_s64 100ULL>=100ULL...passed
test lessthan_s64 100ULL<100ULL...passed
test lessthanorequal_s64 100ULL<=100ULL...passed
test multi_f 100.0f*100.0f...passed
test divi_f 100.0f/100.0f...passed
test cmpa_f 100.0f==100.0f...passed
test sub_f 100.0f-100.0f...passed
test add_f 100.0f+100.0f...passed
test greaterthan_f 100.0f>100.0f...passed
test greaterthanorequal_f 100.0f>=100.0f...passed
test lessthan_f 100.0f<100.0f...passed
test lessthanorequal_f 100.0f<=100.0f...passed
test mul_d 100.0*100.0...passed
test mul_d -0.125*HUGE_VAL...passed
test mul_d 0.125*HUGE_VAL...passed
test mul_d -HUGE_VAL*HUGE_VAL...passed
test mul_d HUGE_VAL*-HUGE_VAL...passed
test div_d 100.0/100.0...passed
test cmp_d 100.0==100.0...passed
test sub_d 100.0-100.0...passed
test add_d 100.0+100.0...passed
test greaterthan_d 100.0>100.0...passed
test greaterthanorequal_d 100.0>=100.0...passed
test lessthan_d 100.0<100.0...passed
test lessthanorequal_d 100.0<=100.0...passed
test f_to_int 0.4 cast --...passed
test f_to_s64 0.4 cast --...passed
test f_to_u64 0.4 cast --...passed
test f_to_s32 0.4 cast --...passed
test f_to_u32 0.4 cast --...passed
test f_to_int 0.4 cast --...passed
test f_to_s64 0.4 cast --...passed
test f_to_u64 0.4 cast --...passed
test f_to_s32 0.4 cast --...passed
test f_to_u32 0.4 cast --...passed
test mul_d -0.125*HUGE_VAL...passed
test div_d HUGE_VAL/-0.125...passed
test cmp_d -0.125==HUGE_VAL...passed
test sub_d -0.125-HUGE_VAL...passed
test add_d -0.125+HUGE_VAL...passed
test greaterthan_d -0.125>HUGE_VAL...passed
test greaterthanorequal_d -0.125>=HUGE_VAL...passed
test lessthan_d HUGE_VAL<-0.125...passed
test lessthan_d HUGE_VAL<=-0.125...passed
test greaterthan_f HUGE_VAL>INFINITY...passed
test greaterthan_f INFINITY>HUGE_VAL...passed
test greaterthan_f INFINITY>NAN...passed
test greaterthan_f NAN>INFINITY...passed
test greaterthan_f HUGE_VAL>NAN...passed
test greaterthan_f NAN>HUGE_VAL...passed
test greaterthan_f HUGE_VAL>HUGE_VAL...passed
test greaterthan_f NAN>NAN...passed
test greaterthan_f INFINITY>INFINITY...passed
test greaterthan_f NAN>0.0f...passed
test greaterthan_f HUGE_VAL>0.0f...passed
test greaterthan_f INFINITY>0.0f...passed
test greaterthan_f 0.0f>NAN...passed
test greaterthan_f 0.0f>HUGE_VAL...passed
test greaterthan_f 0.0f>INFINITY...passed
test greaterthan_f 0.0f>0.0f...passed
test greaterthanorequal_f HUGE_VAL>=INFINITY...passed
test greaterthanorequal_f INFINITY>=HUGE_VAL...passed
test greaterthanorequal_f INFINITY>=NAN...passed
test greaterthanorequal_f NAN>=INFINITY...passed
test greaterthanorequal_f HUGE_VAL>=NAN...passed
test greaterthanorequal_f NAN>=HUGE_VAL...passed
test greaterthanorequal_f HUGE_VAL>=HUGE_VAL...passed
test greaterthanorequal_f NAN>=NAN...passed
test greaterthanorequal_f INFINITY>=INFINITY...passed
test greaterthanorequal_f NAN>=0.0f...passed
test greaterthanorequal_f HUGE_VAL>=0.0f...passed
test greaterthanorequal_f INFINITY>=0.0f...passed
test greaterthanorequal_f 0.0f>=NAN...passed
test greaterthanorequal_f 0.0f>=HUGE_VAL...passed
test greaterthanorequal_f 0.0f>=INFINITY...passed
test greaterthanorequal_f 0.0f>=0.0f...passed
test lessthan_f HUGE_VAL<INFINITY...passed
test lessthan_f INFINITY<HUGE_VAL...passed
test lessthan_f INFINITY<NAN...passed
test lessthan_f NAN<INFINITY...passed
test lessthan_f HUGE_VAL<NAN...passed
test lessthan_f NAN<HUGE_VAL...passed
test lessthan_f HUGE_VAL<HUGE_VAL...passed
test lessthan_f NAN<NAN...passed
test lessthan_f INFINITY<INFINITY...passed
test lessthan_f NAN<0.0f...passed
test lessthan_f HUGE_VAL<0.0f...passed
test lessthan_f INFINITY<0.0f...passed
test lessthan_f 0.0f<NAN...passed
test lessthan_f 0.0f<HUGE_VAL...passed
test lessthan_f 0.0f<INFINITY...passed
test lessthan_f 0.0f<0.0f...passed
test lessthanorequal_f HUGE_VAL<=INFINITY...passed
test lessthanorequal_f INFINITY<=HUGE_VAL...passed
test lessthanorequal_f INFINITY<=NAN...passed
test lessthanorequal_f NAN<=INFINITY...passed
test lessthanorequal_f HUGE_VAL<=NAN...passed
test lessthanorequal_f NAN<=HUGE_VAL...passed
test lessthanorequal_f HUGE_VAL<=HUGE_VAL...passed
test lessthanorequal_f NAN<=NAN...passed
test lessthanorequal_f INFINITY<=INFINITY...passed
test lessthanorequal_f NAN<=0.0f...passed
test lessthanorequal_f HUGE_VAL<=0.0f...passed
test lessthanorequal_f INFINITY<=0.0f...passed
test lessthanorequal_f 0.0f<=NAN...passed
test lessthanorequal_f 0.0f<=HUGE_VAL...passed
test lessthanorequal_f 0.0f<=INFINITY...passed
test lessthanorequal_f 0.0f<=0.0f...passed
tyler-gilbert commented 6 years ago

@shomagan I realize these issues aren't very fun. But once you get more familiar with the system, you can start working on more interesting problems.

shomagan commented 6 years ago

I did not do similar functions before and so for me it very intresting

2018-03-15 20:14 GMT+05:00 Tyler notifications@github.com:

@shomagan https://github.com/shomagan I realize these issues aren't very fun. But once you get more familiar with the system, you can start working on more interesting problems.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/StratifyLabs/sostest/issues/2#issuecomment-373411355, or mute the thread https://github.com/notifications/unsubscribe-auth/AE6GG-yJ6pZvXV_2IxwTp_5-lqGQ9MfMks5teoU9gaJpZM4SjhzL .

shomagan commented 6 years ago

Still need functions? f_to_u16 f_to_s16 f_to_u8 f_to_s8 //int to float //double to int //int to double and test for them