You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
70 lines
1.0 KiB
70 lines
1.0 KiB
#include "unity.h"
|
|
#include "ggT.h"
|
|
|
|
void setUp(){}
|
|
void tearDown(){}
|
|
|
|
void test_ggTOf5And10(){
|
|
//arrange
|
|
int a = 5;
|
|
int b = 10;
|
|
int expected = 5;
|
|
|
|
//act
|
|
int result = ggT(a,b);
|
|
|
|
//assert
|
|
TEST_ASSERT_EQUAL_INT(expected, result);
|
|
}
|
|
|
|
void test_ggTOf0AndPositiveNumber(){
|
|
//arrange
|
|
int a = 0;
|
|
int b = 5;
|
|
int expected = 5;
|
|
|
|
//act
|
|
int result = ggT(a,b);
|
|
|
|
//assert
|
|
TEST_ASSERT_EQUAL_INT(expected, result);
|
|
}
|
|
|
|
void test_ggTOfPositiveAnd0(){
|
|
//arrange
|
|
int a = 10;
|
|
int b = 0;
|
|
int expected = 10;
|
|
|
|
//act
|
|
int result = ggT(a,b);
|
|
|
|
//assert
|
|
TEST_ASSERT_EQUAL_INT(expected, result);
|
|
}
|
|
|
|
void test_ggTOfBoth0(){
|
|
//arrange
|
|
int a = 0;
|
|
int b = 0;
|
|
int expected = 0;
|
|
|
|
//act
|
|
int result = ggT(a,b);
|
|
|
|
//assert
|
|
TEST_ASSERT_EQUAL_INT(expected,result);
|
|
}
|
|
|
|
void test_ggTOfCoprimes(){
|
|
//arrange
|
|
int a = 13;
|
|
int b = 27;
|
|
int expected = 1;
|
|
|
|
//act
|
|
int result = ggT(a,b);
|
|
|
|
//assert
|
|
TEST_ASSERT_EQUAL_INT(expected,result);
|
|
}
|