Added assertEquals(Uint32, Uint32) function

This commit is contained in:
Markus Kauppila 2011-05-23 13:14:09 +03:00
parent f052579c0b
commit 5af8eaab18
3 changed files with 47 additions and 6 deletions

View File

@ -25,13 +25,16 @@ all: runner $(ALL_TESTS)
runner: $(SRC)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $+
asserts.o: asserts.c
$(CC) $(CFLAGS) -c $+ -o $@
tests: $(ALL_TESTS)
libtest.so: test.o
libtest.so: test.o asserts.o
$(CC) -shared -wl,-soname,$@ -o $@ $(LDFLAGS) $+
test.o: $(TEST_SRC)
$(CC) -fPIC $(CFLAGS) -c $+ -o $@
test.o: $(TEST_SRC)
$(CC) -fPIC $(CFLAGS) -c $+ -o $@
Makefile: Makefile.in config.status
$(SHELL) /config.status $@

View File

@ -0,0 +1,29 @@
/*
Copyright (C) 2011 Markus Kauppila <markus.kauppila@gmail.com>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#ifndef _ASSERTS_H
#define _ASSERTS_H
#include <SDL/SDL.h>
void assertEquals(Uint32 expected, Uint32 actual);
#endif

View File

@ -23,14 +23,21 @@
#include <stdio.h>
char *names[] = {"hello", "hello2", "hello3"};
#include <SDL/SDL.h>
char **suite() {
#include "asserts.h"
const char *names[] = {"hello", "hello2", "hello3"};
const char **suite() {
return names;
}
void hello(void *arg){
printf("hello\n");
const char *revision = SDL_GetRevision();
printf("Revision is %s\n", revision);
assertEquals(3, 5);
}
void hello2(void *arg) {
@ -40,6 +47,8 @@ void hello2(void *arg) {
void hello3(void *arg) {
printf("hello\n");
assertEquals(3, 3);
}
#endif