mirror of
https://github.com/alexkay/spek.git
synced 2025-06-10 20:32:12 +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
|
aclocal.m4
|
||||||
autom4te.cache
|
autom4te.cache
|
||||||
compile
|
compile
|
||||||
@ -7,36 +15,28 @@ configure
|
|||||||
data/spek.desktop
|
data/spek.desktop
|
||||||
data/spek.desktop.in
|
data/spek.desktop.in
|
||||||
depcomp
|
depcomp
|
||||||
.deps
|
|
||||||
dist/osx/Spek.app
|
dist/osx/Spek.app
|
||||||
dist/osx/Spek.dmg
|
dist/osx/Spek.dmg
|
||||||
dist/osx/spek.modules
|
dist/osx/spek.modules
|
||||||
dist/win/spek.wxs
|
dist/win/spek.wxs
|
||||||
.DS_Store
|
|
||||||
install-sh
|
install-sh
|
||||||
intltool-extract.in
|
intltool-extract.in
|
||||||
intltool-merge.in
|
intltool-merge.in
|
||||||
intltool-update.in
|
intltool-update.in
|
||||||
libtool
|
libtool
|
||||||
ltmain.sh
|
ltmain.sh
|
||||||
Makefile
|
|
||||||
Makefile.in
|
|
||||||
Makefile.in.in
|
|
||||||
man/spek.1
|
man/spek.1
|
||||||
missing
|
missing
|
||||||
mkinstalldirs
|
mkinstalldirs
|
||||||
*.msi
|
|
||||||
omf.make
|
omf.make
|
||||||
po/*.gmo
|
po/*.gmo
|
||||||
po/.intltool-merge-cache
|
po/.intltool-merge-cache
|
||||||
po/POTFILES
|
po/POTFILES
|
||||||
po/stamp-it
|
po/stamp-it
|
||||||
samples/
|
samples/
|
||||||
src/*.o
|
|
||||||
src/spek
|
|
||||||
src/*.stamp
|
src/*.stamp
|
||||||
|
src/spek
|
||||||
stamp-h1
|
stamp-h1
|
||||||
test*
|
tests/tests
|
||||||
web/version
|
web/version
|
||||||
xmldocs.make
|
xmldocs.make
|
||||||
*.xz
|
|
||||||
|
@ -2,7 +2,8 @@ SUBDIRS = \
|
|||||||
data \
|
data \
|
||||||
man \
|
man \
|
||||||
po \
|
po \
|
||||||
src
|
src \
|
||||||
|
tests
|
||||||
|
|
||||||
EXTRA_DIST = \
|
EXTRA_DIST = \
|
||||||
intltool-extract.in \
|
intltool-extract.in \
|
||||||
|
@ -69,6 +69,7 @@ AC_CONFIG_FILES([
|
|||||||
man/spek.1
|
man/spek.1
|
||||||
po/Makefile.in
|
po/Makefile.in
|
||||||
src/Makefile
|
src/Makefile
|
||||||
|
tests/Makefile
|
||||||
web/version
|
web/version
|
||||||
])
|
])
|
||||||
AC_OUTPUT
|
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