This commit is contained in:
Rens Pastoor
2025-05-27 22:41:46 +02:00
parent d141296aea
commit 11b391b8a1
416 changed files with 25232 additions and 0 deletions

View File

@@ -0,0 +1,76 @@
/*
* auteur : Freddy Hurkmans
* datum : November 15th 2015
* code : C99
*/
#include "calculations.h"
#include "unity.h"
// I rather dislike keeping line numbers updated, so I made my own macro to ditch the line number
#define MY_RUN_TEST(func) RUN_TEST(func, 0)
void setUp(void)
{
// This is run before EACH test
}
void tearDown(void)
{
// This is run after EACH test
}
void test_to_see_if_our_compiler_can_add_2_integers(void)
{
int result = 2;
TEST_ASSERT_EQUAL(result, 1+1);
}
void testswap()
{
int getal1 =15;
int getal2 = 20;
int *getalptr = NULL;
getalptr = &getal1;
int result = swap(getalptr,&getal2);
TEST_ASSERT_EQUAL(0,result);
TEST_ASSERT_EQUAL(20,getal1);
TEST_ASSERT_EQUAL(15,getal2);
getal1 =0;
getal2 = 0;
result = swap(&getal1,&getal2);
TEST_ASSERT_EQUAL(0,result);
TEST_ASSERT_EQUAL(0,getal1);
TEST_ASSERT_EQUAL(0,getal2);
}
void testswapptrnull()
{
int getal1 =15;
int getal2 = 20;
int result = swap(&getal1,NULL);
TEST_ASSERT_EQUAL(-1,result);
result = swap(NULL,&getal2);
TEST_ASSERT_EQUAL(-1,result);
}
int main (int argc, char * argv[])
{
UnityBegin();
MY_RUN_TEST(test_to_see_if_our_compiler_can_add_2_integers);
MY_RUN_TEST(testswap);
MY_RUN_TEST (testswapptrnull);
return UnityEnd();
}