mirror of
https://github.com/alexkay/spek.git
synced 2025-04-17 00:52:20 +03:00
Add tests
This commit is contained in:
parent
b51686a2d9
commit
a687900e18
20
.gitignore
vendored
20
.gitignore
vendored
@ -1,4 +1,12 @@
|
||||
*.msi
|
||||
*.o
|
||||
*.xz
|
||||
*~
|
||||
.DS_Store
|
||||
.deps
|
||||
Makefile
|
||||
Makefile.in
|
||||
Makefile.in.in
|
||||
aclocal.m4
|
||||
autom4te.cache
|
||||
compile
|
||||
@ -7,36 +15,28 @@ configure
|
||||
data/spek.desktop
|
||||
data/spek.desktop.in
|
||||
depcomp
|
||||
.deps
|
||||
dist/osx/Spek.app
|
||||
dist/osx/Spek.dmg
|
||||
dist/osx/spek.modules
|
||||
dist/win/spek.wxs
|
||||
.DS_Store
|
||||
install-sh
|
||||
intltool-extract.in
|
||||
intltool-merge.in
|
||||
intltool-update.in
|
||||
libtool
|
||||
ltmain.sh
|
||||
Makefile
|
||||
Makefile.in
|
||||
Makefile.in.in
|
||||
man/spek.1
|
||||
missing
|
||||
mkinstalldirs
|
||||
*.msi
|
||||
omf.make
|
||||
po/*.gmo
|
||||
po/.intltool-merge-cache
|
||||
po/POTFILES
|
||||
po/stamp-it
|
||||
samples/
|
||||
src/*.o
|
||||
src/spek
|
||||
src/*.stamp
|
||||
src/spek
|
||||
stamp-h1
|
||||
test*
|
||||
tests/tests
|
||||
web/version
|
||||
xmldocs.make
|
||||
*.xz
|
||||
|
@ -2,7 +2,8 @@ SUBDIRS = \
|
||||
data \
|
||||
man \
|
||||
po \
|
||||
src
|
||||
src \
|
||||
tests
|
||||
|
||||
EXTRA_DIST = \
|
||||
intltool-extract.in \
|
||||
|
@ -69,6 +69,7 @@ AC_CONFIG_FILES([
|
||||
man/spek.1
|
||||
po/Makefile.in
|
||||
src/Makefile
|
||||
tests/Makefile
|
||||
web/version
|
||||
])
|
||||
AC_OUTPUT
|
||||
|
18
tests/Makefile.am
Normal file
18
tests/Makefile.am
Normal file
@ -0,0 +1,18 @@
|
||||
check_PROGRAMS = tests
|
||||
|
||||
tests_SOURCES = \
|
||||
test.c
|
||||
|
||||
tests_CPPFLAGS = \
|
||||
-include config.h \
|
||||
-I$(top_builddir)/src \
|
||||
-pthread
|
||||
|
||||
tests_CFLAGS = \
|
||||
$(FFMPEG_CFLAGS)
|
||||
|
||||
tests_LDADD = \
|
||||
$(FFMPEG_LIBS)
|
||||
|
||||
tests_LDFLAGS = \
|
||||
-pthread
|
50
tests/test.c
Normal file
50
tests/test.c
Normal file
@ -0,0 +1,50 @@
|
||||
/* test.c
|
||||
*
|
||||
* Copyright (C) 2012 Alexander Kojevnikov <alexander@kojevnikov.com>
|
||||
*
|
||||
* Spek is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Spek is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Spek. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
static int tests_run;
|
||||
#define mu_assert(message, test) do { if (!(test)) return message; } while (0)
|
||||
#define mu_run_test(test) do { char *message = test(); tests_run++; \
|
||||
if (message) return message; } while (0)
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
static char * test_minunit()
|
||||
{
|
||||
mu_assert("Hello, MinUnit", 2 + 2 == 4);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static char * all_tests()
|
||||
{
|
||||
mu_run_test(test_minunit);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
char *result = all_tests();
|
||||
if (result != 0) {
|
||||
printf("%s\n", result);
|
||||
}
|
||||
else {
|
||||
printf("ALL TESTS PASSED\n");
|
||||
}
|
||||
printf("Tests run: %d\n", tests_run);
|
||||
|
||||
return result != 0;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user