Last active
September 17, 2016 07:46
-
-
Save jeznag/46dd43beb2a99bf4ba0beaa3579a31df to your computer and use it in GitHub Desktop.
unit tests in deluge
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
htmlpage Unit_Tests() | |
displayname = "Unit Tests for atan" | |
content | |
<%{ | |
results = List:Map(); | |
results.add({"function": "atan", "testCase": "50 radians", "actualResult": thisapp.trig.atan(50).round(2), "expectedResult": 1.55, "pass": thisapp.trig.atan(50).round(2) == 1.55}); | |
results.add({"function": "atan", "testCase": "-50 radians", "actualResult": thisapp.trig.atan(-50).round(2), "expectedResult": -1.55, "pass": thisapp.trig.atan(-50).round(2) == -1.55}); | |
results.add({"function": "atan", "testCase": "5 radians", "actualResult": thisapp.trig.atan(5).round(2), "expectedResult": 1.37, "pass": thisapp.trig.atan(5).round(2) == 1.37}); | |
results.add({"function": "atan", "testCase": "0 radians", "actualResult": thisapp.trig.atan(0).round(2), "expectedResult": "0.00", "pass": thisapp.trig.atan(0).round(2) == 0.00}); | |
%> | |
<style> | |
.pass { | |
color: green; | |
} | |
.fail { | |
color: red; | |
} | |
</style> | |
<table> | |
<tr> | |
<th>Function being tested</th> | |
<th>Test case</th> | |
<th>Actual Result</th> | |
<th>Expected Result</th> | |
<th>Pass?</th> | |
</tr> | |
<% | |
for each result in results { | |
%> | |
<tr> | |
<td><%=result.get("function")%></td> | |
<td><%=result.get("testCase")%></td> | |
<td><%=result.get("actualResult")%></td> | |
<td><%=result.get("expectedResult")%></td> | |
<td><%=thisapp.unit_tests.getPassFailSpan(result.get("pass"))%></td> | |
</tr> | |
<% | |
} | |
%> | |
</table> | |
<% | |
}%> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment