/**
* Test case runner
*
* Copyright (C) 2018 R-T Specialty, LLC.
*
* This file is part of TAME.
*
* TAME is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
"use strict";
const { Class } = require( 'easejs' );
/**
* Run test cases and report results
*/
module.exports = Class( 'TestRunner',
{
/**
* SUT
*
* @type {Program}
*/
'private _program': null,
/**
* Test reporter
*
* @type {TestReporter}
*/
'private _reporter': null,
/**
* Initialize runner for program PROGRAM
*
* @param {TestReporter} reporter test reporter
* @param {Program} program SUT
*/
constructor( reporter, program )
{
// primitive check to guess whether this might be a program
if ( typeof program.rater !== 'function' )
{
throw TypeError( "program#rater is not a function" );
}
this._reporter = reporter;
this._program = program;
},
/**
* Run set of test cases
*
* @param {Array} dfns array of TestCases
*
* @return {Array