forked from masotime/java-verifier
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
59 lines (49 loc) · 1.62 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.0/jquery.min.js" type="text/javascript"></script>
<script src="js/prettyprint.js" type="text/javascript"></script>
<script type="text/javascript">
// adapted from https://github.com/tleese22/google-app-engine-jappstart/blob/master/src/main/webapp/js/script.js
function stringifyForm($form) {
var values = {};
$form.find('input[type != submit],textarea').each(function() {
values[this.name] = $(this).val();
});
return JSON.stringify(values);
}
$(function() {
$('input#verifier-submit').click(
function(e) {
$.ajax({
type: 'GET',
url: 'cgi-bin/verifier.py',
data: {jsonrequest: stringifyForm($('form#java-verifier'))},
success: function(data, textStatus, jqXHR) {
$('div#response').empty().append(prettyPrint(data));
}
});
e.preventDefault(); // don't actually submit the form
}
);
});
</script>
</head>
<body>
<form id="java-verifier">
<h2>Java verifier</h2>
<h3>Code to test</h3>
<textarea name="solution" rows="10" cols="80">
String str = "hello world!";
</textarea>
<h3>Assertions</h3>
<textarea name="tests" rows="10" cols="80">
assertEquals("hello world!", str);
</textarea>
<br/>
<input type="submit" id="verifier-submit">Submit</input>
</form>
<div id="response" style="width: 800px;"></div>
</body>
</html>