Add test_asserts module

This commit is contained in:
Eryn Wells 2013-09-09 08:52:35 -07:00
parent bfb1a1b3d5
commit 13ca9abc53
3 changed files with 32 additions and 0 deletions

View file

@ -9,6 +9,7 @@ Import('env')
Import('charles_lib')
files = Split("""
test_asserts.c
test_basics.c
test_charles.c
test_object.c

16
test/test_asserts.c Normal file
View file

@ -0,0 +1,16 @@
/* test_asserts.c
*
* Some helpful asserts built on Check's asserts.
*
* Eryn Wells <eryn@erynwells.me>
*/
#include <check.h>
#include "test_asserts.h"
void
test_assert_within_epsilon(float value, float expected, float epsilon)
{
ck_assert(value >= (expected - epsilon) && value <= (expected + epsilon));
}

15
test/test_asserts.h Normal file
View file

@ -0,0 +1,15 @@
/* test_asserts.h
*
* Some helpful asserts built on Check's asserts.
*
* Eryn Wells <eryn@erynwells.me>
*/
#ifndef __TEST_ASSERT_H__
#define __TEST_ASSERT_H__
void test_assert_within_epsilon(float value, float expected, float epsilon);
#endif