Browse Source

Unittest: CzuF

remotes/origin/temperaturdev
Kevin Ludwig 11 months ago
parent
commit
9928f5be38
  1. 3
      src/temperatur.c
  2. 6
      src/temperatur.h
  3. 22
      test/test_temperatur.c

3
src/temperatur.c

@ -1,4 +1,5 @@
#include <stdio.h>
#include "temperatur.h"
float CzuF(float tempC){
return (tempC * 9/5) + 32;
@ -20,4 +21,4 @@ int run_TemperaturRechner(){
return 0;
}
}

6
src/temperatur.h

@ -0,0 +1,6 @@
#ifndef TEMPERATUR_H
#define TEMPERATUR_H
float CzuF(float tempC);
#endif //TEMPERATUR_H

22
test/test_temperatur.c

@ -0,0 +1,22 @@
#ifdef TEST
#include "unity.h"
#include "temperatur.h"
void setUp(void)
{
}
void tearDown(void)
{
}
void test_temperaturRechner_CzuF(void)
{
float result = CzuF(25);
float expected = 77;
TEST_ASSERT_EQUAL(expected, result);
}
#endif
Loading…
Cancel
Save