1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-01 13:41:34 +00:00
This commit is contained in:
mrdudz 2022-11-17 20:41:49 +01:00
parent cfdf6aef9d
commit c651cb4f1f

View File

@ -39,103 +39,6 @@ int result = 0;
result++; \
}
void constconst(void)
{
//-------------------------------------------------------------------------
// float constant vs float const
printf("const vs const\n");
expect("1.5f == 1.6f is", 0, (1.5f == 1.6f));
expect("1.6f == 1.5f is", 0, (1.6f == 1.5f));
expect("1.6f == 1.6f is", 1, (1.6f == 1.6f));
expect("1.5f != 1.6f is", 1, (1.5f != 1.6f));
expect("1.6f != 1.5f is", 1, (1.6f != 1.5f));
expect("1.6f != 1.6f is", 0, (1.6f != 1.6f));
expect("1.5f < 1.6f is", 1, (1.5f < 1.6f));
expect("1.6f < 1.5f is", 0, (1.6f < 1.5f));
expect("1.6f < 1.6f is", 0, (1.6f < 1.6f));
expect("1.5f > 1.6f is", 0, (1.5f > 1.6f));
expect("1.6f > 1.5f is", 1, (1.6f > 1.5f));
expect("1.6f > 1.6f is", 0, (1.6f > 1.6f));
expect("1.5f <= 1.6f is", 1, (1.5f <= 1.6f));
expect("1.6f <= 1.5f is", 0, (1.6f <= 1.5f));
expect("1.6f <= 1.6f is", 1, (1.6f <= 1.6f));
expect("1.5f >= 1.6f is", 0, (1.5f >= 1.6f));
expect("1.6f >= 1.5f is", 1, (1.6f >= 1.5f));
expect("1.6f >= 1.6f is", 1, (1.6f >= 1.6f));
}
//-------------------------------------------------------------------------
// float constant vs float variable
void constvar(void)
{
printf("const vs var\n");
expect("1.5f == 1.6f is", 0, (1.5f == fp1));
expect("1.6f == 1.5f is", 0, (1.6f == fp2));
expect("1.6f == 1.6f is", 1, (1.6f == fp1));
expect("1.5f != 1.6f is", 1, (1.5f != fp1));
expect("1.6f != 1.5f is", 1, (1.6f != fp2));
expect("1.6f != 1.6f is", 0, (1.6f != fp1));
expect("1.5f < 1.6f is", 1, (1.5f < fp1));
expect("1.6f < 1.5f is", 0, (1.6f < fp2));
expect("1.6f < 1.6f is", 0, (1.6f < fp1));
expect("1.5f > 1.6f is", 0, (1.5f > fp1));
expect("1.6f > 1.5f is", 1, (1.6f > fp2));
expect("1.6f > 1.6f is", 0, (1.6f > fp1));
expect("1.5f <= 1.6f is", 1, (1.5f <= fp1));
expect("1.6f <= 1.5f is", 0, (1.6f <= fp2));
expect("1.6f <= 1.6f is", 1, (1.6f <= fp1));
expect("1.5f >= 1.6f is", 0, (1.5f >= fp1));
expect("1.6f >= 1.5f is", 1, (1.6f >= fp2));
expect("1.6f >= 1.6f is", 1, (1.6f >= fp1));
}
//-------------------------------------------------------------------------
// float variable vs float constant
void varconst(void)
{
printf("var vs const\n");
fp1 = 1.6f;
fp2 = 1.5f;
expect("1.5f == 1.6f is", 0, (fp2 == 1.6f));
expect("1.6f == 1.5f is", 0, (fp1 == 1.5f));
expect("1.6f == 1.6f is", 1, (fp1 == 1.6f));
expect("1.5f != 1.6f is", 1, (fp2 != 1.6f));
expect("1.6f != 1.5f is", 1, (fp1 != 1.5f));
expect("1.6f != 1.6f is", 0, (fp1 != 1.6f));
expect("1.5f < 1.6f is", 1, (fp2 < 1.6f));
expect("1.6f < 1.5f is", 0, (fp1 < 1.5f));
expect("1.6f < 1.6f is", 0, (fp1 < 1.6f));
expect("1.5f > 1.6f is", 0, (fp2 > 1.6f));
expect("1.6f > 1.5f is", 1, (fp1 > 1.5f));
expect("1.6f > 1.6f is", 0, (fp1 > 1.6f));
expect("1.5f <= 1.6f is", 1, (fp2 <= 1.6f));
expect("1.6f <= 1.5f is", 0, (fp1 <= 1.5f));
expect("1.6f <= 1.6f is", 1, (fp1 <= 1.6f));
expect("1.5f >= 1.6f is", 0, (fp2 >= 1.6f));
expect("1.6f >= 1.5f is", 1, (fp1 >= 1.5f));
expect("1.6f >= 1.6f is", 1, (fp1 >= 1.6f));
}
//-------------------------------------------------------------------------
// float variable vs float variable
void varvar(void)
@ -177,13 +80,9 @@ int main(void)
{
printf("float-cmp\n");
constconst();
fp1 = 1.6f;
fp2 = 1.5f;
constvar();
varconst();
varvar();
printf("float-cmp (res: %d)\n", result);