Description:
git-svn-id: http://theory.cpe.ku.ac.th/grader/cli/trunk/scripts@23 6386c4cd-e34a-4fa8-8920-d93eb39b512e
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r10:7176b8668fee - - 1 file changed: 21 inserted, 0 deleted
@@ -48,6 +48,9 | |||||
|
48 | puts "YOU HAVE TO EDIT THE CHECKING CODE HERE: #{__FILE__}" |
|
48 | puts "YOU HAVE TO EDIT THE CHECKING CODE HERE: #{__FILE__}" |
|
49 | exit(127) |
|
49 | exit(127) |
|
50 |
|
50 | ||
|
|
51 | + # below are codes for checking integer and text | ||
|
|
52 | + | ||
|
|
53 | + ########### THIS IS FOR CHECKING INTEGER ########## | ||
|
51 | num_pattern = /^[0-9]*/ |
|
54 | num_pattern = /^[0-9]*/ |
|
52 | if (output_file_content =~ num_pattern) == nil |
|
55 | if (output_file_content =~ num_pattern) == nil |
|
53 | report_wrong.call |
|
56 | report_wrong.call |
@@ -61,3 +64,21 | |||||
|
61 | else |
|
64 | else |
|
62 | report_wrong.call |
|
65 | report_wrong.call |
|
63 | end |
|
66 | end |
|
|
67 | + | ||
|
|
68 | + ########### THIS IS FOR CHECKING TEXT ########## | ||
|
|
69 | + | ||
|
|
70 | + # check visible text | ||
|
|
71 | + | ||
|
|
72 | + out_items = output_file_content.split | ||
|
|
73 | + ans_items = answer_file_content.split | ||
|
|
74 | + | ||
|
|
75 | + if out_items.length != ans_items.length | ||
|
|
76 | + report_wrong.call | ||
|
|
77 | + else | ||
|
|
78 | + out_items.length.times do |i| | ||
|
|
79 | + if out_items[i]!=ans_items[i] | ||
|
|
80 | + report_wrong.call | ||
|
|
81 | + end | ||
|
|
82 | + end | ||
|
|
83 | + report_correct.call | ||
|
|
84 | + end |
You need to be logged in to leave comments.
Login now