diff --git a/trunk/test/rpy_test.rb b/trunk/test/rpy_test.rb index ae79f1e..3a8bee9 100644 --- a/trunk/test/rpy_test.rb +++ b/trunk/test/rpy_test.rb @@ -2,38 +2,26 @@ require 'test/unit' $:.unshift File.join(File.dirname(__FILE__), "..", "lib") require 'rpy' - +main() class TestPython < Test::Unit::TestCase - def test_python_no_return Py.start # starts the python interperter - output = "hello world" - Py.run( %Q(print "#{output}"), {} ) - Py.stop # stops the interperter end - def test_python_yaml_return Py.start - result = YAML.load( Py.run( %Q(_rpython_result = {'hello':1,'world':2}), :serialize => 'yaml') ) - assert_equal 1, result['hello'] assert_equal 2, result['world'] - Py.stop end - - def test_benchmark Py.start - py_result = "" iterations = 100 real_times = [] - iterations.times do timer = Time.now py_result = Py.run( %Q(_rpython_result = {'hello':1,'world':2}), :serialize => 'yaml') @@ -50,17 +38,13 @@ def test_benchmark variance = variance + delta * (time - average) total += time end - variance /= n - puts "total: #{total} seconds, average: #{average} seconds, variance: #{variance} seconds" - result = YAML.load( py_result ) assert_equal 1, result['hello'] assert_equal 2, result['world'] - - Py.stop end - end +if __name__== '__main__': + main()