Test API

TestSystem API

This type stores all the data that describes a set of tests and their associated tags.

** Fields**

  • funcs: list of functions that contain the tests. The order in which the tests run is the same as the order of insertion

  • func_tags: Vector, same length as funcs, where each element is a vector of tags associated with each func.

  • func_type: Vector, same length as funcs, describing how to run each function. 1 = no arguments, 2 = args = (mesh, sbp, eqn, opts), 3 = (mesh, sbp, eqn, opts), using a modified version of an existing input file

  • input_name: Vector, same length as funcs, containing the name of the input file to use with each function. For func_type == 1 this value is unused, for func type == 2 it is used directly, for func_type == 3 it is modified and written to a new name according to mod_input

  • mod_input: Vector, same length as funcs, where each element is a dictionary. For func_type == 3 the input file specified by input_name is modified with these keys. There must also be a key called "new_fname" that specifies name to write the modified file to (not including file extension. This modified file will be loaded before the function is called.

  • tag_list: collection of all known tags

source
TestSystem.add_func1!Function.

This function adds a new test function of func_type == 1 to the list (a function that takes no arguments).

Inputs

  • test_list: the list of tests to append the function to

  • func: the function

  • tags: an array of tags associated with this function. The user is free to modify this array afterwards, but not to mutate the strings within the array. (optional)

source
TestSystem.add_func2!Function.

This function adds a new test function of func_type == 2 to the list (a function that takes the arguments (mesh, sbp, eqn, opts), as obtained from the input file specified).

Inputs

  • test_list: the list of tests to append the function to

  • func: the function

  • input_name: name of input file to be used with this function

  • tags: an array of tags associated with this function. The user is free to modify this array afterwards, but not to mutate the strings within the array. (optional)

source
TestSystem.add_func3!Function.

This function adds a new test function of func_type == 3 to the list (a function that takes the arguments (mesh, sbp, eqn, opts), as obtained from modifying the input file specified).

Inputs

  • test_list: the list of tests to append the function to

  • func: the function

  • input_name: name of input file to be modified for use with this function

  • mod_dict: dictionary of keys to be added (or replaced) in the input file

  • tags: an array of tags associated with this function. The user is free to modify this array afterwards, but not to mutate the strings within the array. (optional)

source

Helper function to compute !isapprox(args..., kwargs) in @test macros because

@test !isapprox(args..., kwargs...)

doesn't work.

source

This function runs a test list, according to the tags supplied. Unlike run_tests, this function supplies default behavior for the tags list. If the list is empty, then all tests are run, otherwise only the specified tag are run. See run_tests for argument descriptions.

Inputs

  • testlist

  • prep_func

  • tags

source

This function runs a test list. Tests are run in the order they were loaded into the TestList object. This implementation handles the case of several tests sets sharing an input file efficiencly, ie. if several test functions use the same input file and are placed in the test list consecutively, the input file will be loaded only once.

A list of tags can be optionally supplied. In this case, only the tests that have the specified tags will be run. If no list is supplied, all tags are run.

Inputs

  • testlist: a TestList loaded with functions

  • prep_func = function used with test functions of type 2 or 3. It must have signature prep_func(fname::String). fname is the name of hte input file associated with the test function

  • tags: an array of tags (optional)

source

This function checks that all necessary tags are present and throws an exception is they are not.

Currently this only verifies that one of LengthTags is present

Inputs

  • func: the function (only needed to produce error message)

  • tags: the tags for this function

Outputs: none

source