1
0
mirror of https://github.com/deadw00d/AROS.git synced 2026-03-19 11:39:53 +00:00

Add test for passing doubles to a library function.

This commit is contained in:
Johan Gill
2024-10-12 22:06:07 +02:00
parent 1c89c0b2b2
commit f79ea72861
4 changed files with 21 additions and 1 deletions

View File

@ -100,6 +100,18 @@ void test_stack_call(void)
CU_ASSERT_EQUAL(r7, e7);
}
void test_stack_double(void)
{
CU_SKIP_IF(SingleBase == NULL);
/* Set initial value */
StackSetValue(0);
const double e1 = 1.25;
double r1 = StackAddDouble2(2.25, -1.0);
CU_ASSERT_EQUAL(r1, e1);
}
void test_close(void)
{
CU_SKIP_IF(SingleBase == NULL);
@ -117,6 +129,7 @@ int main(int argc, char** argv)
CUNIT_CI_TEST(test_base);
CUNIT_CI_TEST(test_reg_call);
CUNIT_CI_TEST(test_stack_call);
CUNIT_CI_TEST(test_stack_double);
CUNIT_CI_TEST(test_close);
return CU_CI_RUN_SUITES();
}

View File

@ -19,4 +19,5 @@ int StackAdd4(int a1, int a2, int a3, int a4)
int StackAdd6(int a1, int a2, int a3, int a4, int a5, int a6)
int StackAdd9(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8, int a9)
int StackAdd4OrMore(int total, int a1, int a2, int a3, int a4, ...)
double StackAddDouble2(double a1, double a2)
##end functionlist

View File

@ -118,3 +118,9 @@ int StackAdd4OrMore(int total, int a1, int a2, int a3, int a4, ...)
va_end(args);
return _return;
}
double StackAddDouble2(double a1, double a2)
{
struct SingleBase *SingleBase = (struct SingleBase *)__aros_getbase_SingleBase();
return SingleBase->value + a1 + a2;
}

View File

@ -81,7 +81,7 @@ If NOT WARN
Execute S/Test cunit/cplusplus/cunit-cplusplus-static ;CPlusPlus_Static_Suite
Echo "===================" >DEBUG:
Echo "Expected tests: 245" >DEBUG:
Echo "Expected tests: 246" >DEBUG:
Echo "===================" >DEBUG:
Endif