rdf-ex/test/acceptance/nquads_w3c_test.exs
2021-12-20 02:22:51 +01:00

41 lines
1.2 KiB
Elixir

defmodule RDF.NQuads.W3C.TestSuite do
@moduledoc """
The official W3C RDF 1.1 N-Quads Test Suite.
from <https://www.w3.org/2013/N-QuadsTests/>
"""
use ExUnit.Case, async: false
use EarlFormatter, test_suite: :nquads
alias RDF.{TestSuite, NQuads}
alias TestSuite.NS.RDFT
@path RDF.TestData.path("N-QUADS-TESTS")
@base "https://www.w3.org/2013/N-QuadsTests/"
@manifest TestSuite.manifest_path(@path) |> TestSuite.manifest_graph(base: @base)
@manifest
|> TestSuite.test_cases(RDFT.TestNQuadsPositiveSyntax)
|> Enum.each(fn test_case ->
@tag test_case: test_case
test TestSuite.test_title(test_case), %{test_case: test_case} do
assert {:ok, %RDF.Dataset{}} =
test_case
|> TestSuite.test_input_file_path(@path)
|> NQuads.read_file()
end
end)
@manifest
|> TestSuite.test_cases(RDFT.TestNQuadsNegativeSyntax)
|> Enum.each(fn test_case ->
@tag test_case: test_case
test TestSuite.test_title(test_case), %{test_case: test_case} do
assert {:error, _} =
test_case
|> TestSuite.test_input_file_path(@path)
|> NQuads.read_file()
end
end)
end