Permalink
Browse files

add some more wide-ranging tests

  • Loading branch information...
mwotton committed Sep 29, 2009
1 parent a2c4b6a commit 0965f3ec2ad5dbd1be663b84925254f92eccb8e6
Showing with 29 additions and 5 deletions.
  1. +29 −5 spec/hubris_spec.rb
View
@@ -125,11 +125,6 @@ def foo_local
# end
end
-load File.dirname(__FILE__) + '/spec_helper.rb'
-
-class Target
- include Hubris
-end
class Target2
include Hubris
@@ -155,6 +150,11 @@ class Target2
# silently ignore the attempt (current behaviour)
# (actually, sometimes you get the old one, sometimes you get the new one. SPOOKY.
# ... ?
+ #
+ # clearly, once I separate function binding from actual haskell compilation, this
+ # problem goes away. Overwriting becomes the sane default, and the old haskell
+ # just stops being referenced, so no linker name problems.
+
it "can overwrite old functions" do
pending "Haven't decided proper semantics"
@@ -212,5 +212,29 @@ class Existing
t.inline("fun _ = T_NIL")
lambda{ e.fun(10)}.should raise_error(NoMethodError)
end
+
+ it "behaves memory-wise" do
+ # so, how on earth do we do this? Conceptually, we want to bind a function,
+ # call it many times, and assert that memory use is (eventually) constant
+ # possible approaches
+ # - caveman: ps, grep etc.
+ # - galois style (is that haskell-dtrace?)
+ end
+ it "behaves concurrently" do
+ # create a bunch of ruby threads which all call a given Haskell function
+ # repeatedly. Checks that we get the right result, and that we don't crash.
+ t = Target.new
+ threads = 100
+ reps=1000
+ t.inline("sumInts n = sum $ [0..n]")
+ res = (0..threads).each { |n| (0..n).sum }
+ lambda {
+ (0..threads).each { |n|
+ Thread.start(n) { |x|
+ reps.times { t.sumInts(x).should eql(res[x]) }
+ }
+ }
+ }.should_not raise_error
+ end
end

0 comments on commit 0965f3e

Please sign in to comment.