These are tests that should be applicable to implemenations of the IGraph protocols. Most examples are drawn from the README. After running tests, query-for-failures should be empty.
These are tests that should be applicable to implemenations of the IGraph protocols. Most examples are drawn from the README. After running tests, query-for-failures should be empty.
Data to be loaded into the test graph for cardinality-1 examples in README
Data to be loaded into the test graph for cardinality-1 examples in README
(do-assert-and-report! report test-fn-name test-name comment observed expected)
Modifies report
with test results of test-name
with comment
from comparing observed
to expected
. Returns @report
Where
report
is an atom containing the report graphtest-name
is a KWI naming a testcomment
is a string describing the testobserved
is some value derived when running the testexpected
is the expected value of running the test.
NOTE: if observed=expected, test-name
will be of type ::Passed, else ::Failed.Modifies `report` with test results of `test-name` with `comment` from comparing `observed` to `expected`. Returns @report Where - `report` is an atom containing the report graph - `test-name` is a KWI naming a test - `comment` is a string describing the test - `observed` is some value derived when running the test - `expected` is the expected value of running the test. NOTE: if observed=expected, `test-name` will be of type ::Passed, else ::Failed.
(do-report! report desc)
Side-effect: Modifies report
in include desc
. Returns @report
Where
report
is an atom containing the report graphdesc
is a normal-form description to be added to report
Side-effect: Modifies `report` in include `desc`. Returns @report Where - `report` is an atom containing the report graph - `desc` is a normal-form description to be added to `report`
Initial data for the eg
graph in the README
Initial data for the `eg` graph in the README
Data to populate a test graph with the eg-with-types
example graph in README
Data to populate a test graph with the `eg-with-types` example graph in README
Contents of the other-eg
graph in the README
Contents of the `other-eg` graph in the README
(query-for-failures report)
Returns #{failure-binding
,...} for report
Where
failure-binding
:= m
s.t. (keys m) :~ #{:?test :?comment :?observed :?expected}report
is a graph put out by one or more tests in test-support
:?test
names a test:?comment
is a string:?observed
is the value acquired in the test:?expected
is the expected value of :?observed
Returns #{`failure-binding`,...} for `report` Where - `failure-binding` := `m` s.t. (keys m) :~ #{:?test :?comment :?observed :?expected} - `report` is a graph put out by one or more tests in `test-support` - `:?test` names a test - `:?comment` is a string - `:?observed` is the value acquired in the test - `:?expected` is the expected value of `:?observed` - NOTE: a passing report should return an empty set.
(report-invalid-test-graph report
test-graph
&
{:keys [test-fn-var protocol content-var
schema-graph]})
Returns report
' if test-graph
is not valid, otherwise nil.
Where
report
is a report graphtest-graph
is a graph provided for a testtest-fn-var
is a #'var naming the operative test
protocolis the expected protocol for
test-graph`content-var
is the var naming the test content, eg #'eg-data
schema-graph
(optional) is a graph initialized with any required schema, but otherwise free of content. Default is nil.
NOTE: typical pattern is (or (report-invalid-test-graph ...) (<do-the-actual-tests>))Returns `report`' if `test-graph` is not valid, otherwise nil. Where - `report` is a report graph - `test-graph` is a graph provided for a test - `test-fn-var` is a #'var naming the operative test ` `protocol` is the expected protocol for `test-graph` - `content-var` is the var naming the test content, eg `#'eg-data` - `schema-graph` (optional) is a graph initialized with any required schema, but otherwise free of content. Default is nil. NOTE: typical pattern is (or (report-invalid-test-graph ...) (<do-the-actual-tests>))
(run-standard-implementation-tests report)
One-liner to test a fully-featured implemenation of all the IGraph protocols.
One-liner to test a fully-featured implemenation of all the IGraph protocols.
(sans-schema g schema-graph)
Returns a native-normal graph with the contents of g
minus schema-graph
Where
g
is the test graph implementing IGraph and containing test contentschema
is a properly configured graph devoid of test content, or nil
NOTE: Some graph implementations will require that you declare a schema up-front, for example Datascript or Datomic. We'll need to extract this before we confirm that we're starting with valid test content.Returns a native-normal graph with the contents of `g` minus `schema-graph` Where - `g` is the test graph implementing IGraph and containing test content - `schema` is a properly configured graph devoid of test content, or nil NOTE: Some graph implementations will require that you declare a schema up-front, for example Datascript or Datomic. We'll need to extract this before we confirm that we're starting with valid test content.
A traversal function. Transitive closure of subClassOf
A traversal function. Transitive closure of subClassOf
(tap-value tap-type tap-val)
Returns tap-val
Side-effect: tap>'s tap-val
in map {:type tap-type
:value tap-val
Returns `tap-val` Side-effect: tap>'s `tap-val` in map {:type `tap-type` :value `tap-val`
(test-cardinality-1 report)
Returns report'
using a graph containing data from the README
Where
report
is a native-normal IGraph recording tests and their outcomes with
vocabulary:
::StandardIGraphImplementationReport
::makeGraphFn
fn [data
] -> cardinality-1-graph
]::StandardIGraphImplementationReport
::schemaGraph
schema-graph
]cardinality-1-graph
contains cardinality-1-graph-data
plus maybe the contents
of schema-graph
schema-graph
is nil, or contains initialization data required by your igraph
implementation.
NOTE: these tests all relate to cardinality-1 behavior as documented in the README.Returns `report'` using a graph containing data from the README Where - `report` is a native-normal IGraph recording tests and their outcomes with vocabulary: - `::StandardIGraphImplementationReport` `::makeGraphFn` fn [`data`] -> `cardinality-1-graph`] - `::StandardIGraphImplementationReport` `::schemaGraph` `schema-graph`] - `cardinality-1-graph` contains `cardinality-1-graph-data` plus maybe the contents of `schema-graph` - `schema-graph` is nil, or contains initialization data required by your igraph implementation. NOTE: these tests all relate to cardinality-1 behavior as documented in the README.
(test-readme-eg-access report)
Returns report'
for report
, given eg-graph
, possibly informed by readme-schema-graph
Where
report
is a native-normal IGraph recording tests and their outcomes with
vocabulary:
::StandardIGraphImplementationReport
::makeGraphFn
fn [data] -> eg-graph
]::StandardIGraphImplementationReport
::schemaGraph
readme-schema-graph
]eg-graph
is a graph in the target IGraph implementation containing
readme-example-content
, created per the configuration of report
readme-schema-graph
(optional) is a target IGraph implementation initialized with
whatever schema configuration is required by the target implementation.
(Datascript for example). Default is nil.data
is an appropriate argument to one of the add methods
NOTE: these tests are for the access functions defined for IGraph.Returns `report'` for `report`, given `eg-graph`, possibly informed by `readme-schema-graph` Where - `report` is a native-normal IGraph recording tests and their outcomes with vocabulary: - `::StandardIGraphImplementationReport` `::makeGraphFn` fn [data] -> `eg-graph`] - `::StandardIGraphImplementationReport` `::schemaGraph` `readme-schema-graph`] - `eg-graph` is a graph in the target IGraph implementation containing `readme-example-content`, created per the configuration of `report` - `readme-schema-graph` (optional) is a target IGraph implementation initialized with whatever schema configuration is required by the target implementation. (Datascript for example). Default is nil. - `data` is an appropriate argument to one of the add methods NOTE: these tests are for the access functions defined for IGraph.
Returns report
', modified per tests on mutability, dispatched on the mutability attribute of the graph under examination.
Returns `report`', modified per tests on mutability, dispatched on the mutability attribute of the graph under examination.
(test-readme-eg-mutation-dispatch report)
Returns the mutability of a graph made according to the report's ::makeGraphFn
Returns the mutability of a graph made according to the report's ::makeGraphFn
(test-readme-eg-mutation-fn context report)
Returns report'
, given eg-graph
and maybe schema-graph
if needed, informed by context
Where
report
is a native-normal IGraph recording tests and their outcomes with
vocabulary:
::StandardIGraphImplementationReport
::makeGraphFn
fn [data
] -> eg-graph
]::StandardIGraphImplementationReport
::schemaGraph
schema-graph
]eg-graph
contains eg-data
, drawn from examples in the README.schema-graph
is nil, or contains initialization data required by your igraph
implementation.context
:= m s.t. (keys m) :~ #{:test-fn-var :protocol :add-fn :subtract-fn :assert-unique-fn}test-fn-var
is a var naming the test function for the :inTest attr in the reportprotocol
is the mutability protocol implemented in eg-graph
add-fn
is a function appropriate to protocol
for adding to eg-graph
subtract-fn
is a function appropriate to protocol
for removing from eg-graph
.assert-unique-fn
is a function appropriate to protocol
for asserting a triple whose object is a singleton (should clobber any previous object).Returns `report'`, given `eg-graph` and maybe `schema-graph` if needed, informed by `context` Where - `report` is a native-normal IGraph recording tests and their outcomes with vocabulary: - `::StandardIGraphImplementationReport` `::makeGraphFn` fn [`data`] -> `eg-graph`] - `::StandardIGraphImplementationReport` `::schemaGraph` `schema-graph`] - `eg-graph` contains `eg-data`, drawn from examples in the README. - `schema-graph` is nil, or contains initialization data required by your igraph implementation. - `context` := m s.t. (keys m) :~ #{:test-fn-var :protocol :add-fn :subtract-fn :assert-unique-fn} - `test-fn-var` is a var naming the test function for the :inTest attr in the report - `protocol` is the mutability protocol implemented in `eg-graph` - `add-fn` is a function appropriate to `protocol` for adding to `eg-graph` - `subtract-fn` is a function appropriate to `protocol` for removing from `eg-graph`. - `assert-unique-fn` is a function appropriate to `protocol` for asserting a triple whose object is a singleton (should clobber any previous object).
(test-readme-eg-set-operations report)
Returns report'
, given eg-graph
based on README examples
Where
report
is a native-normal IGraph recording tests and their outcomes with
vocabulary:
::StandardIGraphImplementationReport
::makeGraphFn
fn [data
] -> eg-graph
]::StandardIGraphImplementationReport
::schemaGraph
schema-graph
]eg-graph
implements IGraphSet and contains eg-data
, drawn from examples in the README.
other-graph
implements IGraphSet and contains other-eg-data
, drawn from examples in the README.
Returns `report'`, given `eg-graph` based on README examples Where - `report` is a native-normal IGraph recording tests and their outcomes with vocabulary: - `::StandardIGraphImplementationReport` `::makeGraphFn` fn [`data`] -> `eg-graph`] - `::StandardIGraphImplementationReport` `::schemaGraph` `schema-graph`] - `eg-graph` implements IGraphSet and contains `eg-data`, drawn from examples in the README. - `other-graph` implements IGraphSet and contains `other-eg-data`, drawn from examples in the README.
(test-readme-eg-traversal report)
Returns report'
given eg-with-types-graph
where
report
is a native-normal IGraph recording tests and their outcomes with
vocabulary:
::StandardIGraphImplementationReport
::makeGraphFn
fn [eg-with-types-data
] -> eg-with-typoes-graph
]::StandardIGraphImplementationReport
::schemaGraph
schema-graph
]eg-with-types-graph
is an instance of the target graph initialized with eg-data
+ eg-with-types-data
, created per the configuration of report
.
NOTE: these tests all have to do with traversal.
Returns `report'` given `eg-with-types-graph` where - `report` is a native-normal IGraph recording tests and their outcomes with vocabulary: - `::StandardIGraphImplementationReport` `::makeGraphFn` fn [`eg-with-types-data`] -> `eg-with-typoes-graph`] - `::StandardIGraphImplementationReport` `::schemaGraph` `schema-graph`] - `eg-with-types-graph` is an instance of the target graph initialized with `eg-data` + `eg-with-types-data`, created per the configuration of `report`. NOTE: these tests all have to do with traversal.
Contents of the eg-with-types
graph from the README.
Contents of the `eg-with-types` graph from the README.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close