README.md in rgot-0.0.3 vs README.md in rgot-0.0.4
- old
+ new
@@ -1,15 +1,15 @@
-rgot
+Rgot
===
[![Build Status](https://travis-ci.org/ksss/rgot.svg)](https://travis-ci.org/ksss/rgot)
Ruby + Golang Testing = Rgot
Rgot is a testing package convert from golang testing.
-### usage
+### Usage
test/sample.rb
```ruby
class Sample
def sum(i, j)
@@ -18,12 +18,10 @@
end
```
test/pass_test.rb
```ruby
-require_relative './sample'
-
module SampleTest
class TypeSum < Struct.new(:left, :right, :expect)
end
DATA = [
@@ -38,19 +36,19 @@
sum = s.sum(ts.left, ts.right)
unless sum.kind_of?(Fixnum)
t.error("expect Fixnum got #{sum.class}")
end
unless sum == ts.expect
- t.error("expect 5 got #{sum}")
+ t.error("expect #{ts.expect} got #{sum}")
end
end
end
end
```
```
-$ rgot -v test/pass_test.rb
+$ rgot -v --require ./test/sample test/pass_test.rb
=== RUN test_pass
--- PASS: test_pass (0.00003s)
PASS
ok 0.001s
```
@@ -166,13 +164,15 @@
```
$ rgot -h
Usage: rgot [options]
-v, --verbose log all tests
- -b, --bench [regexp] benchmark
+ --bench [regexp] benchmark
--benchtime [sec] benchmark running time
--timeout [sec] set timeout sec to testing
+ --require [path] load some code before running
+ --load-path [path] Specify $LOAD_PATH directory
```
## Basic
```
@@ -206,11 +206,11 @@
Show all log and more detail infomation of testing.
## Benchmark
```
-$ rgot target_file_test.rb -b .
+$ rgot target_file_test.rb --bench .
```
Run testing with benchmark.
`.` means match all string for regexp.
@@ -241,11 +241,11 @@
end
```
Main method should be set 'test_main' only.
-variable `m` is a instance of `Rgot::M` class means Main.
+Variable `m` is a instance of `Rgot::M` class means Main.
`Rgot::M#run` start all testing methods.
And return code of process end status.
@@ -312,9 +312,25 @@
# Rgot::B (Benchmark)
For Benchmark class.
Can use log methods same as `Rgot::T` class
+
+## Rgot::B#n
+
+Automatic number calculated by running time.
+
+Recommend to this idiom.
+
+```ruby
+def benchmark_someone(b)
+ i = 0
+ while i < b.n
+ someone()
+ i += 1
+ end
+end
+```
## Rgot::B#reset_timer
Reset benchmark timer