Test::...::Store(3pm)

πŸ“¦
version 1.019 Β· 7 versions
, in debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

✨ NAME ✨

ok so this is Test::RDF::Trine::Store, bestie πŸ’– β€” it's a whole collection of functions whose entire job is testing RDF::Trine::Stores. That's the manual page Test::...::Store(3pm), and yes we're getting into it.


🌸 VERSION 🌸

This doc is describing RDF::Trine version 1.019, no cap.


πŸ¦‹ SYNOPSIS πŸ¦‹

say you wanna test a Memory store? literally just do something like this, it's giving effortless:

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);

periodt. πŸ’…


πŸŽ€ DESCRIPTION πŸŽ€

so this module bundles up a few functions you can call to test an RDF::Trine::Store β€” and lowkey the best part is it works even if that store lives outside the main RDF-Trine distribution. main character energy for real πŸ‘‘

There's a bunch of different functions that each poke at different parts of the functionality, but you should honestly run them all at some point. so for the most part? you're just gonna wanna run the all_store_tests function for quad stores, and all_triple_store_tests for triple stores (iykyk β€” that means stores that don't support named graphs).

and listen: all the functions below are exported. every single one. 🫢


πŸ”₯ FUNCTIONS πŸ”₯

  • number_of_tests β€” hands you back the number of tests that get run with all_store_tests.
  • number_of_triple_tests β€” same vibe, but it returns the number of tests run with all_triple_store_tests.
  • create_data β€” returns a hashref stuffed with generated test data nodes, for the other tests to snack on.
  • all_store_tests ($store, $data, $todo, $args) β€” runs all the available tests for the given store, using the data that came out of create_data. You can also set a third argument to some true value to mark every test as TODO, for when the store is still in development (we've all been there 😭).

And finally, an $args hashref can be passed in. The valid keys are update_sleep (peep the function with the same name, down below) and suppress_dupe_tests if the store should skip duplicate detection, and quads_unsupported if the store is actually a triple store.

  • all_triple_store_tests ($store, $data, $todo, $args) β€” runs tests for the given triple store, i.e. a store that only accepts triples, using the data from create_data. Same deal with the third argument: set it to some true value and all tests get marked as TODO in case the store is in development.

For $args, look above, bestie. πŸ‘†

  • add_quads($store, $args, @quads) β€” lil helper function that adds an array of quads to the given store.
  • add_triples($store, $args, @triples) β€” same energy, but it adds 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} ) β€” also 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 the counts are correct. (count 'em! πŸ”’)
  • count_statements_tests_quads( $store, $args, $data->{ex} ) β€” count statement tests, but for quads.
  • count_statements_tests_triples( $store, $args, $data->{ex}, $data->{nil} ) β€” even more tests for counts, this time 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, it sleeps for that many seconds. This function gets called after update operations, to help out with testing stores that do their updates asynchronously. (go to sleep bestie, you deserve it 😴)

πŸ’€ BUGS πŸ’€

found a bug or want a feature? please report it through the GitHub web interface at <https://github.com/kasei/perlrdf/issues>. we're not mad, we just wanna know πŸ™ˆ


πŸ‘‘ AUTHOR πŸ‘‘

Gregory Todd Williams <gwilliams@cpan.org> and Kjetil Kjernsmo <kjetilk@cpan.org> β€” absolute icons, both of them. πŸŽ€


and that's the whole page, bestie!! this was perl v5.38.2, dated 2024-01-13, and honestly it ate. slay, stay safe, and go test those stores. πŸ’–βœ¨πŸ¦‹

πŸ“¦ where this page comes from