Test::RDF::Trine::Store(3) A collection of functions to test RDF::Trine::Stores

VERSION

This document describes RDF::Trine version 1.014

SYNOPSIS

For example, to test a Memory store, do something like:


use Test::RDF::Trine::Store qw(all_store_tests number_of_tests);
use Test::More tests => 1 + Test::RDF::Trine::Store::number_of_tests;
use RDF::Trine qw(iri variable store literal);
use RDF::Trine::Store;
my $data = Test::RDF::Trine::Store::create_data;
my $store = RDF::Trine::Store::Memory->temporary_store();
isa_ok( $store, 'RDF::Trine::Store::Memory' );
Test::RDF::Trine::Store::all_store_tests($store, $data);

DESCRIPTION

This module packages a few functions that you can call to test a RDF::Trine::Store, also if it is outside of the main RDF-Trine distribution.

There are different functions that will test different parts of the functionality, but you should run them all at some point, thus for the most part, you would just like to run the "all_store_tests" function for quad stores and "all_triple_store_tests" for triple stores (i.e. stores that doesn't support named graphs).

All the below functions are exported.

FUNCTIONS

"number_of_tests"
Returns the number of tests run with "all_store_tests".
"number_of_triple_tests"
Returns the number of tests run with "all_triple_store_tests".
"create_data"
Returns a hashref with generated test data nodes to be used by other tests.
"all_store_tests ($store, $data, $todo, $args)"
Will run all available tests for the given store, given the data from "create_data". You may also set a third argument to some true value to mark all tests as TODO in case the store is in development.

Finally, an $args hashref can be passed. Valid keys are "update_sleep" (see the function with the same name below) and "suppress_dupe_tests" if the store should skip duplicate detection, "quads_unsupported" if the store is a triple store.

"all_triple_store_tests ($store, $data, $todo, $args)"
Will run tests for the given triple store, i.e. a store that only accepts triples, given the data from "create_data". You may also set a third argument to some true value to mark all tests as TODO in case the store is in development.

For $args, see above.

"add_quads($store, $args, @quads)"
Helper function to add an array of quads to the given store.
"add_triples($store, $args, @triples)"
Helper function to add an array of triples to the given store.
"contexts_tests( $store, $args )"
Testing contexts (aka. ``graphs'')
"add_statement_tests_simple( $store, $args, $data->{ex} )"
Tests to check add_statement.
"bulk_add_statement_tests_simple( $store, $args, $data->{ex} )"
Tests to check add_statement.
"literals_tests_simple( $store, $args, $data->{ex})"
Tests to check literals support.
"blank_node_tests_quads( $store, $args, $data->{ex} )"
Tests to check blank node support for quads.
"blank_node_tests_triples( $store, $args, $data->{ex} )"
Tests to check blank node support for triples.
"count_statements_tests_simple( $store, $args,  $data->{ex} )"

Tests to check that counts are correct.
"count_statements_tests_quads( $store, $args, $data->{ex} )"
Count statement tests for quads.
"count_statements_tests_triples( $store, $args, $data->{ex}, $data->{nil} )"
More tests for counts, with triples.
"get_statements_tests_triples( $store, $args, $data->{ex} )"
Tests for getting statements using triples.
"get_statements_tests_quads( $store, $args, $data->{ex}, $data->{nil}  )"

Tests for getting statements using quads.
"get_pattern_tests( $store, $args, $data->{ex} )"
Tests for getting statements using with get_pattern.
"remove_statement_tests( $store, $args, $data->{ex}, @{$data->{names}} );"
Tests for removing statements.
"update_sleep ( \%args )"
If $args{ update_sleep } is defined, sleeps for that many seconds. This function is called after update operations to aid in testing stores that perform updates asynchronously.

BUGS

Please report any bugs or feature requests to through the GitHub web interface at <https://github.com/kasei/perlrdf/issues>.

AUTHOR

 Gregory Todd Williams <[email protected]> and Kjetil Kjernsmo <[email protected]>