core::hash_collection: native array storage is no more nullable
[nit.git] / lib / mnit / mnit_injected_input.nit
index feff6ca..da2e33d 100644 (file)
 # In order to reproduce executions, the behavior of the application must be deterministic
 # for a given sequence of inputs.
 # The main source of differences in executions is caused by the `rand` function,
-# Set the environment variable `MNIT_SRAND` to a value to force srand to be initialized with this value.
+# Set the environment variable `NIT_SRAND` to a value to force srand to be initialized with this value.
 #
 # The input event file is made of event descriptions, one event by line.
 #
-# ~~~
+# ~~~raw
 # 10 click 10.0 20.0
 # 20 quit
 # ~~~
@@ -71,18 +71,13 @@ end
 
 redef class App
        # The stream where injected inputs are read
-       private var injected_input_stream: nullable IStream = null
+       private var injected_input_stream: nullable Reader = null
 
        redef fun setup
        do
-               var env = "MNIT_SRAND".environ
-               if env != null and env != "" then
-                       srand_from(env.to_i)
-               end
-
                var input = "MNIT_READ_INPUT".environ
-               if input != null and input != "" then
-                       injected_input_stream = new IFStream.open(input)
+               if input != "" then
+                       injected_input_stream = new FileReader.open(input)
                        print "GET injected_input_stream {input}"
                end
 
@@ -142,8 +137,9 @@ redef class App
                                print "UNKNOWN EVENT {fs[1]} (on {l})"
                                res = true
                                input(new DummyQuitEvent)
+                               return true
                        end
-                       print "WAIT {wait_next_input} for {next_input}"
+                       print "WAIT {wait_next_input} for {next_input.to_s}"
                end
        end
 end