Browse Source

Unittest: calcBMI

remotes/origin/bmidev
Kevin Ludwig 11 months ago
parent
commit
cb4f6245aa
  1. 1
      src/bmi.c
  2. 6
      src/bmi.h
  3. 22
      test/test_bmi.c

1
src/bmi.c

@ -1,4 +1,5 @@
#include <stdio.h> #include <stdio.h>
#include "bmi.h"
float calcBMI(float a, float b){ float calcBMI(float a, float b){
if(a > 0 && b > 0) if(a > 0 && b > 0)

6
src/bmi.h

@ -0,0 +1,6 @@
#ifndef BMI_H
#define BMI_H
float calcBMI(float height, float weight);
#endif //BMI_H

22
test/test_bmi.c

@ -0,0 +1,22 @@
#ifdef TEST
#include "unity.h"
#include "bmi.h"
void setUp(void)
{
}
void tearDown(void)
{
}
void test_berechnung_BMI(void)
{
float result = calcBMI(2, 100);
float expected = 25;
TEST_ASSERT_EQUAL(expected, result);
}
#endif
Loading…
Cancel
Save