diff options
author | Kirill Simonov <xi@resolvent.net> | 2006-05-20 22:43:15 +0000 |
---|---|---|
committer | Kirill Simonov <xi@resolvent.net> | 2006-05-20 22:43:15 +0000 |
commit | cec6fc98ebecc208edc30a900e6ab195e7c21851 (patch) | |
tree | 5d1010377ff93a7c476f89fcaa8847d83eb4d8ab /tests | |
parent | 9e05b78ca5d1e05a5665da4d503eaad56eb49cb1 (diff) | |
download | libyaml-git-cec6fc98ebecc208edc30a900e6ab195e7c21851.tar.gz |
Add the basic autoconf infrastructure.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Makefile.am | 4 | ||||
-rw-r--r-- | tests/test-version.c | 23 |
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; +} |