Browse Source

Merge branch 'develop' of https://gitlab.cs.hs-fulda.de/fdai7812/theadmirals into develop

remotes/origin/develop
Sandro Welte 11 months ago
parent
commit
aee07149f2
  1. 9
      src/exponentials.c
  2. 6
      src/exponentials.h
  3. 18
      test/test_exponentials.c

9
src/exponentials.c

@ -0,0 +1,9 @@
#include "exponentials.h"
#include <stdlib.h>
#include <math.h>
double* exponentials_double(int base, int exponent) {
double* result = malloc(sizeof(double));
*result = pow(base, exponent);
return result;
}

6
src/exponentials.h

@ -0,0 +1,6 @@
#ifndef THEADMIRALS_EXPONENTIALS_H
#define THEADMIRALS_EXPONENTIALS_H
double* exponentials_double(int, int);
#endif //THEADMIRALS_EXPONENTIALS_H

18
test/test_exponentials.c

@ -0,0 +1,18 @@
#include "../src/exponentials.h"
#include "unity.h"
#include "limits.h"
void setUp(void) {
// set stuff up here
}
void tearDown(void) {
// clean stuff up here
}
void test_exponentials_calculatenumfrombaseandexponent(void) {
double expectedResult = 32.000000;
double* result;
result = exponentials_double(2, 5);
TEST_ASSERT_EQUAL_DOUBLE(expectedResult, *result);
}
Loading…
Cancel
Save