# HG changeset patch # User Jittat Fakcharoenphol # Date 2010-04-28 12:42:33 # Node ID be832795a805347704a60cbd079c5836d9a8e6f3 # Parent 430281f7813c27f08a1d3946910db49e0616ba55 # Parent 7caf7717f3275379f86e1b85e339a9af41c1096e Merge branch 'master' into windows diff --git a/test/data/test1_correct_cc.cc b/test/data/test1_correct_cc.cc new file mode 100644 --- /dev/null +++ b/test/data/test1_correct_cc.cc @@ -0,0 +1,13 @@ +/* +LANG: C++ +*/ +#include + +int main() +{ + int a,b,r; + r = scanf("%d %d",&a,&b); + printf("%d\n",a+b); + return 0; +} + diff --git a/test/engine_spec.rb b/test/engine_spec.rb --- a/test/engine_spec.rb +++ b/test/engine_spec.rb @@ -28,6 +28,17 @@ end + it "should grade normal submission in C++" do + cpp_lang = stub(Language, :name => 'cpp', :ext => 'cpp') + + grader_should(:grade => "test1_correct_cc.cc", + :language => cpp_lang, + :on => @problem_test_normal, + :and_report => { + :score => 135, + :comment => /^(\[|P|\])+/}) + end + it "should produce error message when submission cannot compile" do grader_should(:grade => "test1_compile_error.c", :on => @problem_test_normal, @@ -122,8 +133,9 @@ def grader_should(args) @user1 = stub(User, :id => 1, :login => 'user1') + submission = - create_submission_from_file(1, @user1, args[:on], args[:grade]) + create_submission_from_file(1, @user1, args[:on], args[:grade], args[:language]) submission.should_receive(:graded_at=) expected_score = args[:and_report][:score]