diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2009-10-16 10:43:59 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2009-10-16 10:43:59 +0200 |
commit | b83ab123bb6ba364e22e3665ffafb44686592de6 (patch) | |
tree | 4138be9880fd17cd80aac121df94e1efe40bfbee /tests/cxx/serializer | |
parent | 4ed219d64921e14b9809fd3a535f94fbe2c01d26 (diff) |
Rework the tests to conform to the uniform interface
Diffstat (limited to 'tests/cxx/serializer')
-rw-r--r-- | tests/cxx/serializer/built-in/driver.cxx | 43 | ||||
-rw-r--r-- | tests/cxx/serializer/built-in/makefile | 22 | ||||
-rw-r--r-- | tests/cxx/serializer/built-in/test-000.std (renamed from tests/cxx/serializer/built-in/output-long) | 0 | ||||
-rw-r--r-- | tests/cxx/serializer/built-in/test-001.std (renamed from tests/cxx/serializer/built-in/output-long-long) | 0 |
4 files changed, 50 insertions, 15 deletions
diff --git a/tests/cxx/serializer/built-in/driver.cxx b/tests/cxx/serializer/built-in/driver.cxx index f1d17a1..453fd29 100644 --- a/tests/cxx/serializer/built-in/driver.cxx +++ b/tests/cxx/serializer/built-in/driver.cxx @@ -7,7 +7,8 @@ // #include <stdlib.h> // strtof, strtod -#include <string.h> // memcpy +#include <string.h> // memcpy, strlen, strcmp +#include <fstream> #include <iostream> #include "test-sskel.hxx" @@ -481,7 +482,7 @@ struct root_simpl: root_sskel } case 1: { - string_sequence* r = new string_sequence; + string_sequence* r = new string_sequence; r->push_back ("one"); r->push_back ("two"); r->push_back ("three"); @@ -544,13 +545,13 @@ struct root_simpl: root_sskel { case 0: { - string_sequence* r = new string_sequence; + string_sequence* r = new string_sequence; r->push_back ("one"); return r; } case 1: { - string_sequence* r = new string_sequence; + string_sequence* r = new string_sequence; r->push_back ("two"); r->push_back ("three"); return r; @@ -1190,8 +1191,38 @@ private: }; int -main () +main (int argc, char* argv[]) { + if (argc != 2) + { + cerr << "usage: " << argv[0] << " <test-id>" << endl; + return 1; + } + + // Ignore one of the tests depending on whether long long is available. + // + { + char* s = argv[1]; + size_t n = strlen (s); + + if (strcmp (s + n - 12, +#ifdef XSDE_LONGLONG + "test-000.xml" +#else + "test-001.xml" +#endif + ) == 0) + { + s[n - 3] = 's'; + s[n - 2] = 't'; + s[n - 1] = 'd'; + + ifstream ifs (s); + cout << ifs.rdbuf (); + return 0; + } + } + any_type_simpl any_type_s; any_simple_type_simpl any_simple_type_s; @@ -1231,7 +1262,7 @@ main () #ifdef XSDE_STL xml_schema::qname_simpl qname_s; #else - xml_schema::qname_simpl qname_s (true); + xml_schema::qname_simpl qname_s (true); #endif xml_schema::idrefs_simpl idrefs_s (true); diff --git a/tests/cxx/serializer/built-in/makefile b/tests/cxx/serializer/built-in/makefile index ba93a6d..c0f3c84 100644 --- a/tests/cxx/serializer/built-in/makefile +++ b/tests/cxx/serializer/built-in/makefile @@ -8,6 +8,8 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../../../build/bootstrap.make xsd := test.xsd cxx := driver.cxx +tests := 000 001 + obj := $(addprefix $(out_base)/,$(cxx:.cxx=.o) $(xsd:.xsd=-sskel.o)) dep := $(obj:.o=.o.d) @@ -40,15 +42,17 @@ $(out_base)/: $(driver) # Test. # -$(test): driver := $(driver) - -ifeq ($(xsde_longlong),y) -$(test): $(driver) $(src_base)/output-long-long - $(call message,test $$1,$$1 | diff -u $(src_base)/output-long-long -,$(driver)) -else -$(test): $(driver) $(src_base)/output-long - $(call message,test $$1,$$1 | diff -u $(src_base)/output-long -,$(driver)) -endif +# Test. 000 - long, 001 - long long; the test driver ignores one. The +# input files do not exist. +# +test_targets := $(addprefix $(out_base)/.test-,$(tests)) + +$(test): $(test_targets) +$(test_targets): driver := $(driver) + +.PHONY: $(out_base)/.test-% +$(out_base)/.test-%: $(driver) $(src_base)/test.xsd $(src_base)/test-%.std + $(call message,test $(out_base)/$*,$(driver) $(src_base)/test-$*.xml | diff -u $(src_base)/test-$*.std -) # Clean. diff --git a/tests/cxx/serializer/built-in/output-long b/tests/cxx/serializer/built-in/test-000.std index 7333c2d..7333c2d 100644 --- a/tests/cxx/serializer/built-in/output-long +++ b/tests/cxx/serializer/built-in/test-000.std diff --git a/tests/cxx/serializer/built-in/output-long-long b/tests/cxx/serializer/built-in/test-001.std index b0f36cc..b0f36cc 100644 --- a/tests/cxx/serializer/built-in/output-long-long +++ b/tests/cxx/serializer/built-in/test-001.std |