Module: GSL4r::Harness
- Included in:
- Complex::Harness
- Defined in:
- lib/gsl4r/harness.rb
Constant Summary collapse
- TEST_DIR =
"test"
Instance Attribute Summary collapse
-
#c_binary ⇒ Object
Returns the value of attribute c_binary.
-
#c_includes ⇒ Object
Returns the value of attribute c_includes.
-
#c_libs ⇒ Object
Returns the value of attribute c_libs.
-
#c_src_name ⇒ Object
Returns the value of attribute c_src_name.
-
#c_tests ⇒ Object
Returns the value of attribute c_tests.
-
#r_footer ⇒ Object
Returns the value of attribute r_footer.
-
#r_header ⇒ Object
Returns the value of attribute r_header.
Instance Method Summary collapse
Instance Attribute Details
#c_binary ⇒ Object
Returns the value of attribute c_binary.
13 14 15 |
# File 'lib/gsl4r/harness.rb', line 13 def c_binary @c_binary end |
#c_includes ⇒ Object
Returns the value of attribute c_includes.
13 14 15 |
# File 'lib/gsl4r/harness.rb', line 13 def c_includes @c_includes end |
#c_libs ⇒ Object
Returns the value of attribute c_libs.
13 14 15 |
# File 'lib/gsl4r/harness.rb', line 13 def c_libs @c_libs end |
#c_src_name ⇒ Object
Returns the value of attribute c_src_name.
13 14 15 |
# File 'lib/gsl4r/harness.rb', line 13 def c_src_name @c_src_name end |
#c_tests ⇒ Object
Returns the value of attribute c_tests.
13 14 15 |
# File 'lib/gsl4r/harness.rb', line 13 def c_tests @c_tests end |
#r_footer ⇒ Object
Returns the value of attribute r_footer.
14 15 16 |
# File 'lib/gsl4r/harness.rb', line 14 def @r_footer end |
#r_header ⇒ Object
Returns the value of attribute r_header.
14 15 16 |
# File 'lib/gsl4r/harness.rb', line 14 def r_header @r_header end |
Instance Method Details
#compile_c_tests ⇒ Object
46 47 48 49 50 51 |
# File 'lib/gsl4r/harness.rb', line 46 def compile_c_tests compile_s = "#{@c_compiler} #{@c_flags.join(" ")} " + "-o #{TEST_DIR}/#{@c_binary} #{TEST_DIR}/#{@c_src_name}" p compile_s `#{compile_s}` end |
#run_c_tests(filename) ⇒ Object
53 54 55 |
# File 'lib/gsl4r/harness.rb', line 53 def run_c_tests( filename ) `#{TEST_DIR}/#{@c_binary} > test/#{filename}` end |
#write_c_tests ⇒ Object
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 |
# File 'lib/gsl4r/harness.rb', line 18 def write_c_tests f = File.new("#{TEST_DIR}/#{@c_src_name}", "w") f.puts "/* Auto generated by #{self.class.name} */" f.puts "#include <stdio.h>" @c_includes.each { |i| f.puts "#include \"#{i}\"" } f.puts "int main( int argc, char **argv )\n{\n" f.puts " puts(\"#{@r_header}\");" @c_tests.each { |t| t_fqmn_a = self.class.name.split("::") t_fqmn_a.pop src = "" eval <<-end_eval src = ::#{t_fqmn_a.join("::")}::Methods::#{t} end_eval f.puts " /* #{t} */" f.puts src } f.puts " puts(\"#{@r_footer}\");" f.puts " return(0);\n}\n" f.close end |