blob: b40b28bc21c12ac9a535a175c3a2fba2e96a7b6e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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
45
46
47
|
/************************************************
coverage.c -
$Author: $
Copyright (c) 2008 Yusuke Endoh
************************************************/
#include "ruby.h"
extern void rb_enable_coverages(void);
/* Coverage provides coverage measurement feature for Ruby.
*
* = Usage
*
* (1) require "coverage.so"
* (2) require or load Ruby source file
* (3) Coverage.result will return a hash that contains filename as key and
* coverage array as value.
*
* = Example
*
* [foo.rb]
* s = 0
* 10.times do |x|
* s += x
* end
*
* if s == 45
* p :ok
* else
* p :ng
* end
* [EOF]
*
* require "coverage.so"
* require "foo.rb"
* p COVERAGE__ #=> {"foo.rb"=>[1, 1, 10, nil, nil, 1, 1, nil, 0, nil]}
*/
void
Init_coverage(void)
{
rb_enable_coverages();
}
|