Passing base set instead of TestCase instance to Set subtypes
parent
9923388cce
commit
216231b888
|
@ -93,7 +93,7 @@ rectest.TestRunner = Class( 'TestRunner',
|
||||||
|
|
||||||
var _self = this,
|
var _self = this,
|
||||||
run = this._setFactory.fromId( options.ralgo,
|
run = this._setFactory.fromId( options.ralgo,
|
||||||
test_case, options
|
test_case.getSet( options.set ), options
|
||||||
);
|
);
|
||||||
|
|
||||||
// allow test case to initialize its display
|
// allow test case to initialize its display
|
||||||
|
|
|
@ -7,12 +7,6 @@ rectest.set.RandomGroupedSet = Class( 'RandomGroupedSet' )
|
||||||
.implement( rectest.set.Set )
|
.implement( rectest.set.Set )
|
||||||
.extend(
|
.extend(
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* Test case being executed
|
|
||||||
* @var {TestCase}
|
|
||||||
*/
|
|
||||||
'private _case': null,
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Number of samples remaining
|
* Number of samples remaining
|
||||||
* @var {number}
|
* @var {number}
|
||||||
|
@ -38,10 +32,9 @@ rectest.set.RandomGroupedSet = Class( 'RandomGroupedSet' )
|
||||||
'private _setPos': 0,
|
'private _setPos': 0,
|
||||||
|
|
||||||
|
|
||||||
__construct: function( test_case, options )
|
__construct: function( base_set, options )
|
||||||
{
|
{
|
||||||
this._case = test_case;
|
this._set = base_set;
|
||||||
this._set = test_case.getSet( options.set );
|
|
||||||
this._setLength = this._set.length;
|
this._setLength = this._set.length;
|
||||||
this._samplesRemain = +options.samples || -1;
|
this._samplesRemain = +options.samples || -1;
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,13 @@
|
||||||
*/
|
*/
|
||||||
rectest.set.Set = Interface( 'Set',
|
rectest.set.Set = Interface( 'Set',
|
||||||
{
|
{
|
||||||
__construct: [ 'test_case', 'options' ],
|
/**
|
||||||
|
* Create a new set from a base set and the given options
|
||||||
|
*
|
||||||
|
* @param {Array.<string>} base_set base set
|
||||||
|
* @param {Object} options configuration options
|
||||||
|
*/
|
||||||
|
__construct: [ 'base_set', 'options' ],
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -3,20 +3,15 @@
|
||||||
*/
|
*/
|
||||||
rectest.set.SetFactory = Class( 'SetFactory',
|
rectest.set.SetFactory = Class( 'SetFactory',
|
||||||
{
|
{
|
||||||
'public fromId': function( id, test_case, options )
|
'public fromId': function( id, base_set, options )
|
||||||
{
|
{
|
||||||
var sets = rectest.set;
|
var sets = rectest.set;
|
||||||
|
|
||||||
if ( !( Class.isA( rectest.TestCase, test_case ) ) )
|
|
||||||
{
|
|
||||||
throw TypeError( "Invalid test case: " + test_case );
|
|
||||||
}
|
|
||||||
|
|
||||||
return [
|
return [
|
||||||
null,
|
null,
|
||||||
sets.RandomGroupedSet,
|
sets.RandomGroupedSet,
|
||||||
null,
|
null,
|
||||||
null
|
null
|
||||||
][ id ]( test_case, options );
|
][ id ]( base_set, options );
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
|
|
Loading…
Reference in New Issue