From 22b7d273c0cc7fff3e6149677a5a099c8ad97748 Mon Sep 17 00:00:00 2001 From: xi Date: Sat, 20 May 2006 22:43:15 +0000 Subject: Add the basic autoconf infrastructure. git-svn-id: http://svn.pyyaml.org/libyaml/trunk@169 18f92427-320e-0410-9341-c67f048884a3 --- tests/Makefile.am | 4 ++++ tests/test-version.c | 23 +++++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 tests/Makefile.am create mode 100644 tests/test-version.c (limited to 'tests') diff --git a/tests/Makefile.am b/tests/Makefile.am new file mode 100644 index 0000000..75e52f9 --- /dev/null +++ b/tests/Makefile.am @@ -0,0 +1,4 @@ +AM_CPPFLAGS = -I$(top_srcdir)/include +LDADD = $(top_srcdir)/src/libyaml.la +TESTS = test-version +check_PROGRAMS = test-version diff --git a/tests/test-version.c b/tests/test-version.c new file mode 100644 index 0000000..51b75f4 --- /dev/null +++ b/tests/test-version.c @@ -0,0 +1,23 @@ +#include + +#include +#include +#include + +int +main(void) +{ + int major, minor, patch; + char buf[64]; + + yaml_get_version(&major, &minor, &patch); + sprintf(buf, "%d.%d.%d", major, minor, patch); + assert(strcmp(buf, yaml_get_version_string()) == 0); + assert(yaml_check_version(major+1, minor, patch) == 0); + assert(yaml_check_version(major, minor+1, patch) == 0); + assert(yaml_check_version(major, minor, patch+1) == 1); + assert(yaml_check_version(major, minor, patch) == 1); + assert(yaml_check_version(major, minor, patch-1) == 0); + + return 0; +} -- cgit v1.2.1