Navigation Menu

Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Added assertEquals(Uint32, Uint32) function
Browse files Browse the repository at this point in the history
  • Loading branch information
mkauppila committed May 23, 2011
1 parent 0aa2d58 commit 4bf385e
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 6 deletions.
9 changes: 6 additions & 3 deletions test/test-automation/Makefile.in
Expand Up @@ -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 $@
Expand Down
29 changes: 29 additions & 0 deletions test/test-automation/asserts.h
@@ -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
15 changes: 12 additions & 3 deletions test/test-automation/test.c
Expand Up @@ -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) {
Expand All @@ -40,6 +47,8 @@ void hello2(void *arg) {

void hello3(void *arg) {
printf("hello\n");

assertEquals(3, 3);
}

#endif

0 comments on commit 4bf385e

Please sign in to comment.