summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorxi <xi@18f92427-320e-0410-9341-c67f048884a3>2006-05-20 22:43:15 +0000
committerxi <xi@18f92427-320e-0410-9341-c67f048884a3>2006-05-20 22:43:15 +0000
commit22b7d273c0cc7fff3e6149677a5a099c8ad97748 (patch)
tree5d1010377ff93a7c476f89fcaa8847d83eb4d8ab /tests
parent07d1969082dffefec6feca41b83253cdaf8f4e60 (diff)
downloadlibyaml-22b7d273c0cc7fff3e6149677a5a099c8ad97748.tar.gz
Add the basic autoconf infrastructure.
git-svn-id: http://svn.pyyaml.org/libyaml/trunk@169 18f92427-320e-0410-9341-c67f048884a3
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am4
-rw-r--r--tests/test-version.c23
2 files changed, 27 insertions, 0 deletions
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 <yaml/yaml.h>
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <assert.h>
+
+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;
+}