File Coverage

t/svapi/scope.cc
Criterion Covered Total %
statement 51 51 100.0
branch 26 52 50.0
condition n/a
subroutine n/a
pod n/a
total 77 103 74.7


line stmt bran cond sub pod time code
1             #include
2             #include
3             using namespace xs;
4             using namespace panda;
5              
6 4           static void xs_hints_set (pTHX_ CV*) {
7 4           dVAR; dXSARGS;
8 4 50         if (items != 2) croak("epta!");
9 4 50         auto name = xs::in(ST(0));
10 4           auto val = ST(1);
11 4 50         Scope::Hints::set(name, val);
12 4           XSRETURN(0);
13             }
14              
15 5           static void xs_hints_exists (pTHX_ CV*) {
16 5           dVAR; dXSARGS;
17 5 50         if (items != 1) croak("epta!");
18 5 50         auto name = xs::in(ST(0));
19 5 50         auto ret = Scope::Hints::exists(name);
20 5 100         ST(0) = ret ? &PL_sv_yes : &PL_sv_no;
21 5           XSRETURN(1);
22             }
23              
24 7           static void xs_hints_get (pTHX_ CV*) {
25 7           dVAR; dXSARGS;
26 7 50         if (items != 1) croak("epta!");
27 7 50         auto name = xs::in(ST(0));
28 14 50         auto ret = Scope::Hints::get(name);
29 7 50         ST(0) = ret.detach_mortal();
30 14           XSRETURN(1);
31             }
32              
33 4           static void xs_hints_remove (pTHX_ CV*) {
34 4           dVAR; dXSARGS;
35 4 50         if (items != 1) croak("epta!");
36 4 50         auto name = xs::in(ST(0));
37 4 50         Scope::Hints::remove(name);
38 4           XSRETURN(0);
39             }
40              
41 3           static void xs_hints_get_hash (pTHX_ CV*) {
42 3           dVAR; dXSARGS;
43 3 50         if (items != 0) croak("epta!");
44 6 50         auto ret = Scope::Hints::get();
45 3 50         EXTEND(SP, 1);
    0          
46 3 50         ST(0) = Ref::create(ret).detach_mortal();
    50          
47 6           XSRETURN(1);
48             }
49              
50 1           static void xs_hints_get_ct (pTHX_ CV*) {
51 1           dVAR; dXSARGS;
52 1 50         if (items != 1) croak("epta!");
53 1 50         auto name = xs::in(ST(0));
54 2 50         auto ret = Scope::Hints::get_ct(name);
55 1 50         ST(0) = ret.detach_mortal();
56 2           XSRETURN(1);
57             }
58              
59 34           static bool init () {
60 34           auto file = "scope.cc";
61 34           newXS("MyTest::Hints::set", &xs_hints_set, file);
62 34           newXS("MyTest::Hints::exists", &xs_hints_exists, file);
63 34           newXS("MyTest::Hints::get", &xs_hints_get, file);
64 34           newXS("MyTest::Hints::remove", &xs_hints_remove, file);
65 34           newXS("MyTest::Hints::get_hash", &xs_hints_get_hash, file);
66 34           newXS("MyTest::Hints::get_ct", &xs_hints_get_ct, file);
67 34           return true;
68             }
69              
70 136 50         static bool _init = init();
    50