aboutsummaryrefslogtreecommitdiffstats
path: root/wscript
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2018-05-12 13:28:47 +0200
committerDavid Robillard <d@drobilla.net>2020-10-27 13:13:58 +0100
commit2be5c4870ebc6dc3f0562dcf53eda3c946981a1c (patch)
treeabc513fd38b6ca183c9fa02ec5148a89b4aa6f31 /wscript
parent0e8a72aae08b64beb11d97f020c14126178d7545 (diff)
downloadserd-2be5c4870ebc6dc3f0562dcf53eda3c946981a1c.tar.gz
serd-2be5c4870ebc6dc3f0562dcf53eda3c946981a1c.tar.bz2
serd-2be5c4870ebc6dc3f0562dcf53eda3c946981a1c.zip
Add model
Diffstat (limited to 'wscript')
-rw-r--r--wscript44
1 files changed, 42 insertions, 2 deletions
diff --git a/wscript b/wscript
index a3defa1a..1b41b7b1 100644
--- a/wscript
+++ b/wscript
@@ -28,8 +28,9 @@ post_tags = ['Hacking', 'RDF', 'Serd']
def options(ctx):
ctx.load('compiler_c')
+ opt = ctx.configuration_options()
ctx.add_flags(
- ctx.configuration_options(),
+ opt,
{'no-utils': 'do not build command line utilities',
'stack-check': 'include runtime stack sanity checks',
'static': 'build static library',
@@ -149,9 +150,13 @@ lib_source = ['src/base64.c',
'src/byte_source.c',
'src/cursor.c',
'src/env.c',
+ 'src/inserter.c',
+ 'src/iter.c',
+ 'src/model.c',
'src/n3.c',
'src/node.c',
'src/nodes.c',
+ 'src/range.c',
'src/reader.c',
'src/sink.c',
'src/statement.c',
@@ -161,6 +166,7 @@ lib_source = ['src/base64.c',
'src/uri.c',
'src/world.c',
'src/writer.c',
+ 'src/zix/btree.c',
'src/zix/digest.c',
'src/zix/hash.c']
@@ -226,10 +232,13 @@ def build(bld):
('cursor_test', 'tests/cursor_test.c'),
('env_test', 'tests/env_test.c'),
('free_null_test', 'tests/free_null_test.c'),
+ ('model_test', 'tests/model_test.c'),
('nodes_test', 'tests/nodes_test.c'),
('overflow_test', 'tests/overflow_test.c'),
('read_chunk_test', 'tests/read_chunk_test.c'),
- ('serd_test', 'tests/serd_test.c')]:
+ ('serd_test', 'tests/serd_test.c'),
+ ('sink_test', 'tests/sink_test.c'),
+ ('statement_test', 'tests/statement_test.c')]:
bld(features = 'c cprogram',
source = prog[1],
use = 'libserd_profiled',
@@ -493,6 +502,23 @@ def _option_combinations(options):
return itertools.cycle(combinations)
+def _file_lines_equal(patha, pathb, subst_from='', subst_to=''):
+ import io
+
+ for path in (patha, pathb):
+ if not os.access(path, os.F_OK):
+ Logs.pprint('RED', 'error: missing file %s' % path)
+ return False
+
+ la = sorted(set(io.open(patha, encoding='utf-8').readlines()))
+ lb = sorted(set(io.open(pathb, encoding='utf-8').readlines()))
+ if la != lb:
+ autowaf.show_diff(la, lb, patha, pathb)
+ return False
+
+ return True
+
+
def test_suite(ctx, base_uri, testdir, report, isyntax, options=[]):
srcdir = ctx.path.abspath()
@@ -547,6 +573,17 @@ def test_suite(ctx, base_uri, testdir, report, isyntax, options=[]):
if report is not None:
report.write(earl_assertion(test, result, asserter))
+ if expected_return == 0:
+ # Run model test for positive test (must succeed)
+ out_path = action + '.model.out'
+ check([command[0]] + ['-m'] + command[1:],
+ stdout=out_path,
+ name=action + ' model')
+
+ if result and ((mf + 'result') in model[test]):
+ check(lambda: _file_lines_equal(check_path, out_path),
+ name=action + ' model check')
+
ns_rdftest = 'http://www.w3.org/ns/rdftest#'
for test_class, instances in instances.items():
if test_class.startswith(ns_rdftest):
@@ -576,10 +613,13 @@ def test(tst):
check(['./cursor_test'])
check(['./env_test'])
check(['./free_null_test'])
+ check(['./model_test'])
check(['./nodes_test'])
check(['./overflow_test'])
check(['./read_chunk_test'])
check(['./serd_test'])
+ check(['./sink_test'])
+ check(['./statement_test'])
def test_syntax_io(check, in_name, check_name, lang):
in_path = 'tests/good/%s' % in_name