testsuite

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 25, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApprovalType

type ApprovalType string
const (
	Approved ApprovalType = "rdft:Approved"
	Proposed ApprovalType = "rdft:Proposed"
	Rejected ApprovalType = "rdft:Rejected"
)

type Developer

type Developer struct {
	IRI      ttl.IRI
	Name     string
	Title    string
	MBox     string
	Homepage string
}

type Manifest

type Manifest struct {
	Keys    []string
	Entries map[string]*Test
}

func LoadManifest

func LoadManifest(raw string) (*Manifest, error)

type OutcomeValue

type OutcomeValue string

OutcomeValue describes a resulting condition from carrying out the test.

const (
	// Passed - the subject passed the test.
	Passed OutcomeValue = "earl:passed"
	// Failed - the subject failed the test.
	Failed OutcomeValue = "earl:failed"
	// CantTell - it is unclear if the subject passed or failed the test.
	CantTell OutcomeValue = "earl:cantTell"
	// Inapplicable - the test is not applicable to the subject.
	Inapplicable OutcomeValue = "earl:inapplicable"
	// Untested - the test has not been carried out.
	Untested OutcomeValue = "earl:untested"
)

type Project

type Project struct {
	IRI                 ttl.IRI
	Name                string
	Homepage            string
	License             string
	Description         string
	Created             time.Time
	ProgrammingLanguage string
	Implements          []string
	Developer           []Developer
}

type Report

type Report struct {
	Project Project
	// contains filtered or unexported fields
}

func NewReport

func NewReport() *Report
Example
package main

import (
	"fmt"
	"github.com/0x51-dev/rdf/internal/testsuite"

	ttl "github.com/0x51-dev/rdf/turtle"
	"time"
)

func main() {
	r := testsuite.NewReport()
	r.AddTestCase(testsuite.TestCase{
		AssertedBy: ttl.IRI{Value: "https://github.com/q-uint"},
		Mode:       testsuite.Automatic,
		Result: testsuite.TestResult{
			Date: ttl.StringLiteral{
				Value:       "2023-09-09+00:00",
				DatatypeIRI: &ttl.IRI{Prefixed: true, Value: "xsd:date"},
			},
			Outcome: testsuite.Passed,
		},
		Subject: ttl.IRI{Value: "https://github.com/0x51-dev/rdf"},
		Test:    ttl.IRI{Value: "http://example.com/test"},
	})
	r.Project = testsuite.Project{
		IRI:                 ttl.IRI{Value: "https://github.com/0x51-dev/rdf"},
		Name:                "RDF",
		Homepage:            "https://github.com/0x51-dev/rdf",
		License:             "https://www.apache.org/licenses/LICENSE-2.0",
		Description:         "RDF is a Go library for working with RDF data.",
		Created:             time.Date(2023, 7, 15, 0, 0, 0, 0, time.UTC),
		ProgrammingLanguage: "Go",
		Implements: []string{
			"https://www.w3.org/TR/turtle/",
		},
		Developer: []testsuite.Developer{
			{
				IRI:      ttl.IRI{Value: "https://github.com/q-uint"},
				Name:     "Quint Daenen",
				Title:    "Implementor",
				MBox:     "mailto:[email protected]",
				Homepage: "https://0x51.dev",
			},
		},
	}
	fmt.Println(r)
}
Output:

@prefix dc: <http://purl.org/dc/elements/1.1/> .
@prefix rdft: <http://www.w3.org/ns/rdftest#> .
@prefix earl: <http://www.w3.org/ns/earl#> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix turtletest: <http://www.w3.org/2013/TurtleTests/manifest.ttl#> .
@prefix dct: <http://purl.org/dc/terms/> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix doap: <http://usefulinc.com/ns/doap#> .
<https://github.com/q-uint> a foaf:Person, earl:Assertor ; foaf:name "Quint Daenen" ; foaf:title "Implementor" ; foaf:mbox <mailto:[email protected]> ; foaf:homepage <https://0x51.dev> .
<https://github.com/0x51-dev/rdf> a doap:Project ; doap:name "RDF" ; doap:homepage <https://github.com/0x51-dev/rdf> ; doap:license <https://www.apache.org/licenses/LICENSE-2.0> ; doap:description "RDF is a Go library for working with RDF data."@en ; doap:created "2023-07-15+0000"^^xsd:date ; doap:programming-language <Go> ; doap:implements <https://www.w3.org/TR/turtle/> ; doap:developer <https://github.com/q-uint> .
[ a earl:Assertion ; earl:assertedBy <https://github.com/q-uint> ; earl:mode earl:automatic ; earl:result [ a earl:TestResult ; dct:date "2023-09-09+00:00"^^xsd:date ; earl:outcome earl:passed ] ; earl:subject <https://github.com/0x51-dev/rdf> ; earl:test <http://example.com/test> ] .

func (*Report) AddTestCase

func (r *Report) AddTestCase(tc TestCase)

func (*Report) Len

func (r *Report) Len() int

func (*Report) String

func (r *Report) String() string

type Test

type Test struct {
	Type     string
	Name     string
	Comment  string
	Approval ApprovalType
	Action   string
	Result   string
}

func NewTest

func NewTest(triple *ttl.Triple) (*Test, error)

type TestCase

type TestCase struct {
	AssertedBy ttl.IRI
	Mode       TestMode
	Result     TestResult
	Subject    ttl.IRI
	Test       ttl.IRI
}

type TestMode

type TestMode string

TestMode describes how a test was carried out.

const (
	// Automatic - where the test was carried out automatically by the software tool and without any human intervention.
	Automatic TestMode = "earl:automatic"
	// Manual - where the test was carried out by human evaluators. This includes the case where the evaluators are
	// aided by instructions or guidance provided by software tools, but where the evaluators carried out the actual
	// test procedure.
	Manual TestMode = "earl:manual"
	// SemiAuto - where the test was partially carried out by software tools, but where human input or judgment was
	// still required to decide or help decide the outcome of the test.
	SemiAuto TestMode = "earl:semiAuto"
	// Undisclosed - where the exact testing process is undisclosed.
	Undisclosed TestMode = "earl:undisclosed"
	// UnknownMode - where the testing process is unknown or undetermined.
	UnknownMode TestMode = "earl:unknownMode"
)

type TestResult

type TestResult struct {
	Date    ttl.StringLiteral
	Outcome OutcomeValue
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL