Class

class Benchmark

public class Benchmark {}

Description: Provides methods for creating and running individual performance test cases.

prop name

public prop name: String

Description: Obtains the name of a test case.

Type: String

func run()

public func run(): BenchReport 

Description: Runs the performance test case.

Returns:

static func create(String, Configuration, () -> Unit)

public static func create(name: String, configuration!: Configuration = Configuration(), body!: () -> Unit): Benchmark

Description: Creates a performance test case object.

Parameters:

  • name: String: case name
  • configuration!: Configuration: test case configuration information
  • body!: () -> Unit: test case executor

Returns:

static func createParameterized<T>(String, DataStrategy<T>, Configuration, (T) -> Unit)

public static func createParameterized<T>(name: String, strategy: DataStrategy<T>, configuration!: Configuration = Configuration(), body!: (T) -> Unit): Benchmark

Description: Creates a parameterized performance test case object.

Parameters:

  • name: String: case name
  • strategy: DataStrategy: parameter data strategy
  • configuration!: Configuration: test case configuration information
  • body!: () -> Unit: test case executor

Returns:

static func createParameterized<T>(String, DataStrategyProcessor<T>, Configuration, (T) -> Unit)

public static func createParameterized<T>(name: String, strategy: DataStrategyProcessor<T>, configuration!: Configuration = Configuration(), body!: (T) -> Unit): Benchmark

Description: Creates a parameterized performance test case object.

Parameters:

Returns:

class BenchReport

public class BenchReport <: Report {}

Description: Provides capabilities for handling performance test case execution result reports.

Parent Type:

func reportTo<T>(Reporter<BenchReport, T>)

public func reportTo<T>(reporter: Reporter<BenchReport, T>): T

Description: Prints the performance test case result report.

Parameters:

Returns:

  • T: the result printed. Generally the value is of the Unit type.

class CartesianProductProcessor

public class CartesianProductProcessor<T0,T1> <: DataStrategyProcessor<(T0,T1)> {}

Description: Specifies a Cartesian product processor.

Parent Type:

init(DataStrategyProcessor<T0>, DataStrategyProcessor<T1>)

public CartesianProductProcessor(let left: DataStrategyProcessor<T0>, let right: DataStrategyProcessor<T1>)

Description: Specifies a constructor.

Parameters:

class ConsoleReporter

public class ConsoleReporter <: Reporter<TestReport, Unit> & Reporter<BenchReport, Unit>{
    public ConsoleReporter(let colored!: Bool = true)
}

Description: Prints the unit test case results or performance test case results to the console.

Parent Type:

init(Bool)

public ConsoleReporter(let colored!: Bool = true)

Description: Specifies a constructor.

Parameters:

  • colored!: Bool: Specifies whether colored printing is used. By default, colored printing is used.

class CsvReporter

public class CsvReporter <: Reporter<BenchReport, Unit> {
    public CsvReporter(let directory: Directory)
}

Description: Prints the performance test case results to a CSV file.

Parent Type:

init(Directory)

public CsvReporter(let directory: Directory)

Description: Specifies a constructor.

Parameters:

  • directory: Directory: directory where the printed file is generated

class CsvRawReporter

public class CsvRawReporter <: Reporter<BenchReport, Unit> {
    public CsvRawReporter(let directory: Directory)
}

Description: Prints the performance test case results, which contain only a batch of raw measurement data, to a CSV file.

Parent Type:

init(Directory)

public CsvRawReporter(let directory: Directory)

Description: Specifies a constructor.

Parameters:

  • directory: Directory: directory where the printed file is generated

class CsvStrategy

public class CsvStrategy<T> <: DataStrategy<T> where T <: Serializable<T> {}

Description: Indicates serialization implementation by DataStrategy on the CSV data format.

Parent Type:

func provider(Configuration)

public override func provider(configuration: Configuration): SerializableProvider<T>

Description: Generates a serialized data iterator.

Parameters:

Returns:

class DataStrategyProcessor

abstract sealed class DataStrategyProcessor<T> {}

Description: Specifies a base class for all DataStrategy components. Instances of this class are created by the @Strategy macro or member function.

prop isInfinite

protected prop isInfinite: Bool

Description: Checks whether the strategy is infinite.

Type: Bool

func intoBenchmark(String, Configuration, (T, Int64, Int64) -> Float64)

public func intoBenchmark(
    caseName!: String,
    configuration!: Configuration,
    doRun!: (T, Int64, Int64) -> Float64
): Benchmark

Description: Specifies an auxiliary function used by the code generated by the macro. It is used to create performance test cases that use the strategy.

Parameters:

  • caseName!: String: test case name
  • configuration!: Configuration: configuration information
  • doRun!: (T, Int64, Int64) -> Float64: performance test case executor

Returns:

func intoUnitTestCase(String, Configuration, (T) -> Unit)

public func intoUnitTestCase(
    caseName!: String,
    configuration!: Configuration,
    doRun!: (T) -> Unit
): UnitTestCase

Description: Specifies an auxiliary function used by the code generated by the macro. It is used to create test cases that use the strategy.

Parameters:

  • caseName!: String: test case name
  • configuration!: Configuration: configuration information
  • doRun!: (T) -> Unit: performance test case executor

Returns:

func lastItemInfo()

protected func lastItemInfo(): Array<InputParameter>

Description: Obtains the information about the last handled item.

Returns:

func lastItem(Configuration)

protected func lastItem(configuration: Configuration): T

Description: Obtains the last handled item.

Parameters:

  • configuration : Configuration: configuration information of the handling strategy

Returns:

  • T: last handled item

func provide(Configuration)

protected func provide(configuration: Configuration): Iterable<T>

Description: Generates a data iterator based on the configuration information and data strategy.

Parameters:

  • configuration : Configuration: configuration information of the handling strategy

Returns:

func shrinkLastItem(Configuration, LazyCyclicNode)

protected func shrinkLastItem(configuration: Configuration, engine: LazyCyclicNode): Iterable<T>

Description: Shrinks the last item.

Parameters:

Returns:

  • Iterable<T>: data iterator after shrinking

static func start(DataStrategy<T>, String)

public static func start(s: DataStrategy<T>, name: String): SimpleProcessor<T>

Description: Specifies a start point for the composition and mapping of DataStrategy.

Parameters:

Returns:

static func start<U>(() -> DataStrategy<U>, String)

public static func start<U>(f: () -> DataStrategy<U>, name: String): DataStrategyProcessor<U> where U <: BenchInputProvider < T >

Description: Specifies a start point for the composition and mapping of DataStrategy.

Parameters:

Returns:

static func start(() -> DataStrategy<T>, String, Int64)

public static func start(f: () -> DataStrategy<T>, name: String, x!: Int64 = 0): SimpleProcessor<T>

Description: Specifies a start point for the composition and mapping of DataStrategy.

Parameters:

  • s: () -> DataStrategy<T>: closure generating the data strategy
  • name: String: case name
  • x!: Int64: parameter added to reconstruct different return values

Returns:

static func start(() -> DataStrategyProcessor<T>, String)

public static func start(f: () -> DataStrategyProcessor<T>, name: String): DataStrategyProcessor<T>

Description: Specifies a start point for the composition and mapping of DataStrategy.

Parameters:

Returns:

static func start<U>(() -> DataStrategyProcessor<U>, String, Int64)

public static func start<U>(f: () -> DataStrategyProcessor<U>, name: String, x!: Int64 = 0):
    DataStrategyProcessor<U> where U <: BenchInputProvider<T>

Description: Specifies a start point for the composition and mapping of DataStrategy.

Parameters:

  • s: () -> DataStrategyProcessor<U> : closure generating the data strategy processor
  • name: String: case name
  • x!: Int64: parameter added to reconstruct different return values

Returns:

extend <T> DataStrategyProcessor<T>

extend <T> DataStrategyProcessor<T> {}

func map<R>((T) -> R)

public func map<R>(f: (T) -> R): MapProcessor<T, R> 

Description: Simply applies f to each item of the original data strategy. Shrink also occurs on the original input before mapping.

Parameters:

  • f: (T) -> R: processing logic function to be applied

Returns:

func mapWithConfig<R>((T, Configuration) -> R)

public func mapWithConfig<R>(f: (T, Configuration) -> R): MapProcessor<T, R>

Description: Allows access to the current Configuration and applies f to each item of the original data strategy. Shrink also occurs on the original input before mapping.

Parameters:

  • f: (T, Configuration) -> R: processing logic function to be applied

Returns:

func flatMap<R>((T) -> DataProvider<R>)

public func flatMap<R>(f: (T) -> DataProvider<R>): FlatMapProcessor<T, R>

Description: Simply applies f to each item of the original data strategy, and then flattens the result. Shrink also occurs on the original input before flatMap is applied.

Parameters:

  • f: (T) -> DataProvider<R>: processing logic function to be applied

Returns:

func flatMapStrategy((T) -> DataStrategy<R>)

public func flatMapStrategy<R>(f: (T) -> DataStrategy<R>): FlatMapStrategyProcessor<T, R>

Description: Simply applies f to each item of the original data strategy, and then flattens the result. Shrink is completed through the returned strategy rather than the original input.

Parameters:

  • f: (T) -> DataStrategy<R>: processing logic function to be applied

Returns:

func product(DataStrategyProcessor<R>)

public func product<R>(p: DataStrategyProcessor<R>): CartesianProductProcessor<T, R>

Description: Indicates a data strategy created by the Cartesian product combiner that contains all possible permutations of elements in the original strategy. For an infinite strategy, it iterates over all finite sub-strategies before advancing the infinite sub-policies. Shrink occurs independently and uniformly on each element of the original strategy.

Parameters:

Returns:

class FlatMapProcessor

public class FlatMapProcessor<T,R> <: DataStrategyProcessor<R> {}

Description: Specifies a processor applying FlatMap on parameter data.

Parent Type:

class FlatMapStrategyProcessor

public class FlatMapStrategyProcessor<T,R> <: DataStrategyProcessor<R> {}

Description: Specifies a processor applying FlatMap on parameter data.

Parent Type:

class InputParameter

public class InputParameter {}

Description: Specifies an input parameter object type.

class JsonStrategy

public class JsonStrategy<T> <: DataStrategy<T> where T <: Serializable<T> {}

Description: Indicates serialization implementation by DataStrategy on the JSON data format.

Parent Type:

func provider(Configuration)

public override func provider(configuration: Configuration): SerializableProvider<T>

Description: Generates a serialized data iterator.

Parameters:

Returns:

  • SerializableProvider<T>: serialized iterator object

class LazyCyclicNode

public open class LazyCyclicNode {}

Description: Specifies an internal lazy iterator used to advance type erasure one after another in a loop.

func advance()

protected open func advance(): ?Unit

Description: Advances by one value.

Returns:

  • ?Unit: If advancement cannot be made, None is returned; otherwise, Unit is returned.

func recover()

protected open func recover(): Unit

Description: Restores or moves back by one value.

class MapProcessor

public class MapProcessor<T,R> <: DataStrategyProcessor<R> {}

Description: Specifies a processor for handling parameter data with Map.

Parent Type:

class PowerAssertDiagramBuilder

public class PowerAssertDiagramBuilder {
    public init(expression: String, initialPosition: Int64)
}

Description: Specifies a constructor of the PowerAssert output result.

init(String, Int64)

public init(expression: String, initialPosition: Int64)

Description: Specifies a constructor.

Parameters:

  • expression: String: expression string
  • initialPosition: Int64: initial position of the expression

func r<T>(T, String, Int64)

public func r<T>(value: T, exprAsText: String, position: Int64): T 

Description: Records comparison data.

Parameters:

  • value: T: data being recorded
  • exprAsText: String: expression string
  • position: Int64: position information

Returns:

  • T: data being recorded

func r(String, String, Int64)

public func r(value: String, exprAsText: String, position: Int64): String

Description: Records comparison data.

Parameters:

  • value: String: data being recorded
  • exprAsText: String: expression string
  • position: Int64: position information

Returns:

func h(Exception, String, Int64)

public func h(exception: Exception, exprAsText: String, position: Int64): Nothing

Description: Handles exceptions.

Parameters:

  • exception: Exception: exception to be handled
  • exprAsText: String: expression string
  • position: Int64: position information

func w(Bool)

public func w(passed: Bool): Unit

Description: Returns a success result if the test case is passed; throws an exception and prints the comparison result if it fails.

Parameters:

  • passed: Bool: whether the test case is passed

class RandomDataProvider

public class RandomDataProvider<T> <: DataProvider<T> where T <: Arbitrary<T> {
    public RandomDataProvider(private let configuration: Configuration)
}

Description: Implements the DataProvider interface generated by random data.

Parent Type:

init(Configuration)

public RandomDataProvider(private let configuration: Configuration)

Description: Constructs an object for the random data provider.

Parameters:

  • configuration: Configuration: configuration object, which must contain a random generator named random, of type random.Random.

Throws:

prop isInfinite

public override prop isInfinite: Bool

Description: Specifies whether infinite data is generated.

Type: Bool

func provide()

public override func provide(): Iterable<T>

Description: Provides randomly generated data.

Returns:

  • Iterable<T>: infinite iterator created from arbitrary instances of T

class RandomDataShrinker

public class RandomDataShrinker<T> <: DataShrinker<T> {}

Description: Indicates DataShrinker implementation generated using random data.

Parent Type:

func shrinker(T)

public override func shrink(value: T): Iterable<T>

Description: Obtains the shrinker for the value.

Parameters:

  • value: T: parameter value

Returns:

  • Iterable<T>: If the parameter implements the Shrink interface, an iterator of the shrunk values is returned. If not, an empty array is returned.

class RandomDataStrategy

public class RandomDataStrategy<T> <: DataStrategy<T> where T <: Arbitrary<T>{}

Description: Indicates DataStrategy implementation generated using random data.

Parent Type:

func provider(Configuration)

public override func provider(configuration: Configuration): RandomDataProvider<T>

Description: Obtains the provider of random data.

Parameters:

  • configuration: Configuration: parameter configuration information

Returns:

func shrinker(Configuration)

public override func shrinker(_: Configuration): RandomDataShrinker<T>

Description: Obtains the shrinker for random data.

Parameters:

Returns:

class Report

sealed abstract class Report {}

Description: Specifies a base class for printing test case result reports.

prop errorCount

public prop errorCount: Int64

Description: Obtains the number of test cases with errors.

Type: Int64

prop caseCount

public prop caseCount: Int64

Description: Obtains the number of test cases.

Type: Int64

prop passedCount

public prop passedCount:   Int64

Description: Obtains the number of passed test cases.

Type: Int64

prop failedCount

public prop failedCount:   Int64

Description: Obtains the number of failed test cases.

Type: Int64

prop skippedCount

public prop skippedCount:   Int64

Description: Obtains the number of skipped test cases.

Type: Int64

class RawStatsReporter

public class RawStatsReporter <: Reporter<BenchReport, HashMap<String, (Float64, Float64)>> {
    public RawStatsReporter()
}

Description: Reports raw performance test data. It is used only in the framework.

Parent Type:

init()

public RawStatsReporter()

Description: Specifies a constructor.

class SerializableProvider

public class SerializableProvider<T> <: DataProvider<T> where T <: Serializable<T> {}

Description: Implements the DataProvider interface for obtaining serialized data.

Parent Type:

prop isInfinite

public prop isInfinite: Bool

Description: Specifies whether infinite data is generated.

Bool

func provide()

public override func provide(): Iterable<T> 

Description: Obtains the data iterator.

Returns:

class SimpleProcessor

public class SimpleProcessor<T> <: DataStrategyProcessor<T> {}

Description: Indicates simple data strategy processor implementation of DataStrategyProcessor.

Parent Type:

init(() -> DataStrategy<T>, String)

public SimpleProcessor(let buildDelegate:() -> DataStrategy<T>, let name: String)

Description: Specifies a constructor.

Parameters:

  • buildDelegate : () -> DataStrategy<T>: closure generating the data strategy
  • name: String: processor name

class TestGroup

public class TestGroup {}

Description: Provides methods for building and running test groups.

prop name

public prop name: String

Description: Obtains the name of a test group.

Type: String

func runBenchmarks()

public func runBenchmarks(): BenchReport

Description: Runs all performance test cases.

Returns:

func runBenchmarks(Configuration)

public func runBenchmarks(Configuration): BenchReport

Description: Executes all performance test cases with running configurations.

Parameters:

Returns:

func runTests()

public func runTests(): TestReport

Description: Executes all unit test cases.

Returns:

func runTests(Configuration)

public func runTests(configuration: Configuration): TestReport

Description: Executes all unit test cases with running configurations.

Parameters:

Returns:

static func builder(String)

public static func builder(name: String): TestGroupBuilder

Description: Creates a test group builder.

Parameters:

  • name: String: test group name

Returns:

static func builder(TestGroup)

public static func builder(group: TestGroup): TestGroupBuilder

Description: Creates a test group builder.

Parameters:

Returns:

class TestGroupBuilder

public class TestGroupBuilder {}

Description: Provides methods for configuring test groups.

func add(Benchmark)

public func add(benchmark: Benchmark): TestGroupBuilder

Description: Adds performance test cases for the test group.

Parameters:

  • benchmark: Benchmark: performance test case

Returns:

func add(TestSuite)

public func add(suite: TestSuite): TestGroupBuilder

Description: Adds a unit test suite for a test group.

Parameters:

Returns:

func add(UnitTestCase)

public func add(test: UnitTestCase): TestGroupBuilder

Description: Adds unit test cases for the test group.

Parameters:

Returns:

func build()

public func build(): TestGroup

Description: Builds test group objects after the configuration is complete.

Returns:

func configure(Configuration)

public func configure(configuration: Configuration): TestGroupBuilder

Description: Configures the configuration information for the test group.

Parameters:

Returns:

func setName(String)

public func setName(name: String): TestGroupBuilder

Description: Sets a name for the test group.

Parameters:

Returns:

class TestPackage

public class TestPackage {
    public TestPackage(let name: String)
}

Description: Specifies a test case package object.

init(String)

public TestPackage(let name: String)

Description: Specifies a constructor.

Parameters:

  • name: String: test case package name

func registerCase(() -> UnitTestCase)

public func registerCase(testCase: () -> UnitTestCase): Unit

Description: Registers unit test cases.

Parameters:

  • testCase: () -> UnitTestCase : closure generating unit test cases

func registerSuite(() -> TestSuite)

public func registerSuite(suite: () -> TestSuite): Unit

Description: Registers a test suite.

Parameters:

  • suite: () -> TestSuite: closure generating the test suite

func registerBench(() -> Benchmark)

public func registerBench(bench: () -> Benchmark): Unit

Description: Registers performance test cases.

Parameters:

  • bench: () -> Benchmark: closure generating performance test cases

class TestReport

public class TestReport <: Report {}

Description: Reports the unit test result.

Parent Type:

func reportTo<T>(Reporter<TestReport, T>)

public func reportTo<T>(reporter: Reporter<TestReport, T>): T

Description: Prints the unit test execution report.

Parameters:

Returns:

  • T: Unit

class TestSuite

public class TestSuite {}

Description: Provides methods for building and executing test suites.

prop name

public prop name: String

Description: Obtains the name of a test suite.

Type: String

func runBenchmarks()

public func runBenchmarks(): BenchReport 

Description: Runs all performance test cases.

Returns:

func runBenchmarks(Configuration)

public func runBenchmarks(configuration: Configuration): BenchReport

Description: Runs all performance test cases with configuration information.

Parameters:

  • configuration : Configuration: running configuration information.

Returns:

  • BenchReport: running results of the performance test cases

func runTests()

public func runTests(): TestReport

Description: Runs the test suite.

Returns:

  • TestReport: running result of the test suite

func runTests(Configuration)

public func runTests(configuration: Configuration): TestReport

Description: Runs the test suite with configuration information.

Parameters:

  • configuration : Configuration: running configuration information.

Returns:

static func builder(String)

public static func builder(name: String): TestSuiteBuilder

Description: Creates a test suite builder.

Parameters:

  • name: String: test suite name

Returns:

static func builder(TestSuite)

public static func builder(suite: TestSuite): TestSuiteBuilder

Description: Creates a test suite builder.

Parameters:

Returns:

class TestSuiteBuilder

public class TestSuiteBuilder {}

Description: Provides methods for configuring test suites.

add(Benchmark)

public func add(benchmark: Benchmark): TestSuiteBuilder

Description: Adds performance cases to a test suite.

Parameters:

  • benchmark: Benchmark: performance test case

Returns:

add(UnitTestCase)

public func add(test: UnitTestCase): TestSuiteBuilder

Description: Adds unit test cases to a test suite.

Parameters:

Returns:

afterAll(() -> Unit)

public func afterAll(body: () -> Unit): TestSuiteBuilder

Description: Adds to a test suite a lifecycle management closure to be executed after all test cases have been completed.

Parameters:

  • body: () -> Unit: executor

Returns:

afterEach(() -> Unit)

public func afterEach(body: () -> Unit): TestSuiteBuilder

Description: Adds to a test suite a lifecycle management closure to be executed after each test case has been completed.

Parameters:

  • body: () -> Unit: executor

Returns:

afterEach((String) -> Unit)

public func afterEach(body: (String) -> Unit): TestSuiteBuilder

Description: Adds to a test suite a lifecycle management closure to be executed after each test case has been completed.

Parameters:

  • body: (String) -> Unit: executor

Returns:

beforeAll(() -> Unit)

public func beforeAll(body: () -> Unit): TestSuiteBuilder

Description: Adds to a test suite a lifecycle management closure to be executed before the execution of all test cases.

Parameters:

  • body: () -> Unit: executor

Returns:

beforeEach(() -> Unit)

public func beforeEach(body: () -> Unit): TestSuiteBuilder

Description: Adds to a test suite a lifecycle management closure to be executed before the execution of each test case.

Parameters:

  • body: () -> Unit: executor

Returns:

beforeEach((String) -> Unit)

public func beforeEach(body: (String) -> Unit): TestSuiteBuilder

Description: Adds to a test suite a lifecycle management closure to be executed before the execution of each test case.

Parameters:

  • body: (String) -> Unit: executor

Returns:

build()

public func build(): TestSuite

Description: Constructs a test suite after the configuration is complete.

Returns:

configure(Configuration)

public func configure(configuration: Configuration): TestSuiteBuilder

Description: Adds configuration information to a test suite.

Parameters:

Returns:

setName(String)

public func setName(name: String): TestSuiteBuilder

Description: Sets a name for the test suite.

Parameters:

  • name: String: test suite name

Returns:

class UnitTestCase

public class UnitTestCase {}

Description: Provides methods for creating and executing unit test cases.

prop name

public prop name: String

Description: Obtains the name of a unit test.

Type: String

func run()

public func run(): TestReport 

Description: Runs unit test cases.

Returns:

static func create(String, Configuration, () -> Unit)

public static func create(name: String, configuration!: Configuration = Configuration(), body!: () -> Unit): UnitTestCase

Description: Creates a unit test case.

Parameters:

  • name: String: test case name
  • configuration!: Configuration: test case configuration information
  • body!: () -> Unit: test case executor

Returns:

static func createParameterized<T>(String, DataStrategy<T>, Configuration, (T) -> Unit)

public static func createParameterized<T>(name: String, strategy: DataStrategy<T>, configuration!: Configuration = Configuration(), body!: (T) -> Unit): UnitTestCase

Description: Creates a parameterized unit test case.

Parameters:

  • name: String: test case name
  • strategy: DataStrategy: parameter data strategy
  • configuration!: Configuration: test case configuration information
  • body!: () -> Unit: test case executor

Returns:

static func createParameterized<T>(String, DataStrategyProcessor<T>, Configuration, (T) -> Unit)

public static func createParameterized<T>(name: String, strategy: DataStrategyProcessor<T>, configuration!: Configuration = Configuration(), body!: (T) -> Unit): UnitTestCase

Description: Creates a parameterized unit test case.

Parameters:

Returns:

class XmlReporter

public class XmlReporter <: Reporter<TestReport, Unit> {
    public XmlReporter(let directory: Directory)
}

Description: Prints unit test case results to an XML file.

Parent Type:

init(Path)

public XmlReporter(let directory: Directory)

Description: Specifies a constructor.

Parameters:

  • directory: Directory: directory where the printed file is generated