forked from drlippman/IMathAS
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into EC.fixes1
- Loading branch information
Showing
15 changed files
with
161 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<?php | ||
//Unit tests for specific functions | ||
//(c) 2018 IMathAS | ||
|
||
require("../init.php"); | ||
|
||
if ($myrights<100) { | ||
echo "Unauthorized"; | ||
exit; | ||
} | ||
|
||
|
||
//each test is [string to look at, requiretimes, expected result] | ||
$reqtimestests = [ | ||
['3x^2+4x', 'x,=2,3,>0', 1], | ||
['3x+30x^2+4', '3,=2', 1], | ||
['3x+30x^2+4', '#3,=1', 1], | ||
]; | ||
|
||
//each test is [string to test, answerformat, expected result] | ||
$ansformattests = [ | ||
['4/6', 'fraction', true], | ||
['4/6', 'reducedfraction', false] | ||
]; | ||
|
||
require("../assessment/displayq2.php"); | ||
|
||
foreach ($reqtimestests as $test) { | ||
echo "Testing ".Sanitize::encodeStringForDisplay($test[0]); | ||
echo " against ".Sanitize::encodeStringForDisplay($test[1]); | ||
echo ": "; | ||
if (checkreqtimes($test[0], $test[1])==$test[2]) { | ||
echo '<span style="color:green">Pass</span>'; | ||
} else { | ||
echo '<span style="color:red">Fail</span>'; | ||
} | ||
echo '<br/>'; | ||
} | ||
|
||
foreach ($ansformattests as $test) { | ||
echo "Testing ".Sanitize::encodeStringForDisplay($test[0]); | ||
echo " with ".Sanitize::encodeStringForDisplay($test[1]); | ||
echo ": "; | ||
if (checkanswerformat($test[0], $test[1])==$test[2]) { | ||
echo '<span style="color:green">Pass</span>'; | ||
} else { | ||
echo '<span style="color:red">Fail</span>'; | ||
} | ||
echo '<br/>'; | ||
} | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters