defineFunction, added assert

git-svn-id: svn://10.0.0.236/trunk@65595 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
beard%netscape.com
2000-04-11 05:09:38 +00:00
parent 8ac9fe969d
commit e24d19e2ad
2 changed files with 6 additions and 10 deletions

View File

@@ -388,8 +388,7 @@ static float64 testFunctionCall(World &world, float64 n)
// preset the global property "sum" to contain the above function
JSValue v(funCode);
defineGlobalProperty(widenCString("sum"), JSValue(v));
defineFunction(sum, funCode);
JSValue result = interpret(script.complete(), JSValues());
std::cout << "sum(" << n << ") = " << result.f64 << std::endl;
@@ -439,8 +438,7 @@ static float64 testFactorial(World &world, float64 n)
// preset the global property "fact" to contain the above function
StringAtom& fact = world.identifiers[widenCString("fact")];
JSValue v(icm);
defineGlobalProperty(fact, v);
defineFunction(fact, icm);
// now a script :
// return fact(n);
@@ -534,7 +532,7 @@ int main(int argc, char **argv)
assert(testFactorial(world, 5) == 120);
assert(testObjects(world, 5) == 5);
// testICG(world);
testFunctionCall(world, 5);
assert(testFunctionCall(world, 5) == 5);
#endif
readEvalPrint(stdin, world);
return 0;