testsuite

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2020 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Package testsuite contains data structures and functionality to be able to run chess test suites which contain chess positions as EPD (Extended Position Description). EPD contain a standard FEN of a position but also meta data to describe a result for a successful test. This could be best move on the position, mate in x or avoid moves. https://www.chessprogramming.org/Extended_Position_Description For the purpose of testing our chess engine only the opcodes "bm" (best move), "am" (avoid move) and "dm" (direct mate) are implemented.

Index

Constants

View Source
const (
	None testType = iota
	DM   testType = iota
	BM   testType = iota
	AM   testType = iota
)

Implemented test types.

View Source
const (
	NotTested resultType = iota
	Skipped   resultType = iota
	Failed    resultType = iota
	Success   resultType = iota
)

resultType define possible results for a tests as a type and constants.

Variables

This section is empty.

Functions

func FeatureTests added in v1.0.0

func FeatureTests(folder string, searchTime time.Duration, searchDepth int) string

FeatureTests runs all epd tests in a folder and prints a report

Types

type SuiteResult

type SuiteResult struct {
	Counter          int
	SuccessCounter   int
	FailedCounter    int
	SkippedCounter   int
	NotTestedCounter int
	Nodes            uint64
	Time             time.Duration
}

SuiteResult data structure to collect sum of the results of tests.

type Test

type Test struct {
	// contains filtered or unexported fields
}

Test defines the data structure for a test after reading in the test files. Each EPD from the read file will create an instance of this struct and when the tests are run the result will be stored back to this instance.

type TestSuite

type TestSuite struct {
	Tests      []*Test
	Time       time.Duration
	Depth      int
	FilePath   string
	LastResult *SuiteResult
}

TestSuite is the data structure for the running a file of EPD tests.

func NewTestSuite

func NewTestSuite(filePath string, searchTime time.Duration, depth int) (*TestSuite, error)

NewTestSuite creates an instance of a TestSuite and reads in the given file to create test cases which can be run with RunTests().

func (*TestSuite) RunTests

func (ts *TestSuite) RunTests()

RunTests runs tests on a successfully created instance of a TestSuite.

Jump to

Keyboard shortcuts

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