Class: CppTestHook

Inherits:
Mumukit::Templates::FileHook
  • Object
show all
Defined in:
lib/test_hook.rb

Instance Method Summary collapse

Instance Method Details

#command_line(filename) ⇒ Object



9
10
11
# File 'lib/test_hook.rb', line 9

def command_line(filename)
  "runcppunit #{filename}"
end

#compile_file_content(request) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/test_hook.rb', line 23

def compile_file_content(request)
  <<EOF
#include <cppunit/ui/text/TestRunner.h>
#include <cppunit/extensions/HelperMacros.h>

#{super}
int main( int argc, char **argv)
{
CppUnit::TextUi::TestRunner runner;
runner.addTest( MumukiTest::suite() );
runner.run();
return 0;
}
EOF
end

#post_process_file(file, result, status) ⇒ Object



13
14
15
16
17
18
19
20
21
# File 'lib/test_hook.rb', line 13

def post_process_file(file, result, status)
  if result.include? '!!TEST FINISHED WITH COMPILATION ERROR!!'
    [result, :errored]
  elsif result.include? '!!!FAILURES!!!'
    [result, :failed]
  else
    [result, :passed]
  end
end

#tempfile_extensionObject



5
6
7
# File 'lib/test_hook.rb', line 5

def tempfile_extension
  '.cpp'
end