A set of handy function to debug the script. More...
Public Member Functions | |
void | assertEqual (var v1, var v2) |
Throws an error message if the values are not equal. More... | |
void | assertIsDefined (var value) |
Throws an error message if the value is undefined. More... | |
void | assertIsObjectOrArray (var value) |
Throws an error message if the value is not an object or array. More... | |
void | assertLegalNumber (var value) |
Throws an error message if the value is not a legal number (eg. More... | |
void | assertTrue (var condition) |
Throws an error message if the condition is not true. More... | |
void | clear () |
Clears the console. More... | |
void | print (var debug) |
Prints a message to the console. More... | |
void | start () |
Starts the benchmark. More... | |
void | stop () |
Stops the benchmark and prints the result. More... | |
Public Member Functions inherited from ApiClass | |
void | addConstant (String constantName, var value) |
Adds a constant. More... | |
void | addFunction (const Identifier &id, call0 newFunction) |
Adds a function with no parameters. More... | |
void | addFunction1 (const Identifier &id, call1 newFunction) |
Adds a function with one parameter. More... | |
void | addFunction2 (const Identifier &id, call2 newFunction) |
Adds a function with two parameters. More... | |
void | addFunction3 (const Identifier &id, call3 newFunction) |
Adds a function with three parameters. More... | |
void | addFunction4 (const Identifier &id, call4 newFunction) |
Adds a function with four parameters. More... | |
void | addFunction5 (const Identifier &id, call5 newFunction) |
Adds a function with five parameters. More... | |
ApiClass (int numConstants_) | |
Creates a Api class with the given amount of constants. More... | |
var | callFunction (int index, var *args, int numArgs) |
Calls the function with the index and the argument data. More... | |
void | getAllConstants (Array< Identifier > &ids) const |
Returns all constant names as alphabetically sorted array. More... | |
void | getAllFunctionNames (Array< Identifier > &ids) const |
This returns all function names alphabetically sorted. More... | |
int | getConstantIndex (const Identifier &id) const |
Return the index for the given name. More... | |
Identifier | getConstantName (int index) const |
Returns the name for the constant as it is used in the scripting context. More... | |
const var | getConstantValue (int index) const |
Returns the constant at the given index. More... | |
void | getIndexAndNumArgsForFunction (const Identifier &id, int &index, int &numArgs) const |
This will fill in the information for the given function. More... | |
A set of handy function to debug the script.
void assertEqual | ( | var | v1, |
var | v2 | ||
) |
Throws an error message if the values are not equal.
void assertIsDefined | ( | var | value | ) |
Throws an error message if the value is undefined.
void assertIsObjectOrArray | ( | var | value | ) |
Throws an error message if the value is not an object or array.
void assertLegalNumber | ( | var | value | ) |
Throws an error message if the value is not a legal number (eg.
string or array or infinity or NaN).
void assertTrue | ( | var | condition | ) |
Throws an error message if the condition is not true.
void clear | ( | ) |
Clears the console.
void print | ( | var | debug | ) |
Prints a message to the console.
|
inline |
Starts the benchmark.
You can give it a name that will be displayed with the result if desired.
void stop | ( | ) |
Stops the benchmark and prints the result.