t/svapi/scope.cc

filter: Statementstmt 100% 53 / 53 Branchbran 50.0% 24 / 48 Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 76.2% 77 / 101 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
« t/typemap/typemap_xsgen.cc ↑ Summary src/xs/Sv.cc »
1 #include <xs.h>
2 #include <xs/Scope.h>
3 using namespace xs;
4 using namespace panda;
5  
6 4 static void xs_hints_set (pTHX_ CV*) {
7 4 dVAR; dXSARGS;
8 4 ▶ if (items != 2) croak("epta!");
Branch: 1 branch
BranchTrueFalseTotal
if (items != 2) croak("epta!"); 0 4 4
9 4 ▶ auto name = xs::in<string_view>(ST(0));
Branch: 1 branch
BranchTrueFalseTotal
auto name = xs::in<string_view>(ST(0)); 4 0 4
10 4 auto val = ST(1);
11 4 ▶ Scope::Hints::set(name, val);
Branch: 1 branch
BranchTrueFalseTotal
Scope::Hints::set(name, val); 4 0 4
12 8 XSRETURN(0);
13 }
14  
15 5 static void xs_hints_exists (pTHX_ CV*) {
16 5 dVAR; dXSARGS;
17 5 ▶ if (items != 1) croak("epta!");
Branch: 1 branch
BranchTrueFalseTotal
if (items != 1) croak("epta!"); 0 5 5
18 5 ▶ auto name = xs::in<string_view>(ST(0));
Branch: 1 branch
BranchTrueFalseTotal
auto name = xs::in<string_view>(ST(0)); 5 0 5
19 5 ▶ auto ret = Scope::Hints::exists(name);
Branch: 1 branch
BranchTrueFalseTotal
auto ret = Scope::Hints::exists(name); 5 0 5
20 5 ▶ ST(0) = ret ? &PL_sv_yes : &PL_sv_no;
Branch: 1 branch
BranchTrueFalseTotal
ST(0) = ret ? &PL_sv_yes : &PL_sv_no; 2 3 5
21 10 XSRETURN(1);
22 }
23  
24 7 static void xs_hints_get (pTHX_ CV*) {
25 7 dVAR; dXSARGS;
26 7 ▶ if (items != 1) croak("epta!");
Branch: 1 branch
BranchTrueFalseTotal
if (items != 1) croak("epta!"); 0 7 7
27 7 ▶ auto name = xs::in<string_view>(ST(0));
Branch: 1 branch
BranchTrueFalseTotal
auto name = xs::in<string_view>(ST(0)); 7 0 7
28 7 ▶ auto ret = Scope::Hints::get(name);
Branch: 1 branch
BranchTrueFalseTotal
auto ret = Scope::Hints::get(name); 7 0 7
29 7 ▶ ST(0) = ret.detach_mortal();
Branch: 1 branch
BranchTrueFalseTotal
ST(0) = ret.detach_mortal(); 7 0 7
30 14 XSRETURN(1);
31 7 }
32  
33 4 static void xs_hints_remove (pTHX_ CV*) {
34 4 dVAR; dXSARGS;
35 4 ▶ if (items != 1) croak("epta!");
Branch: 1 branch
BranchTrueFalseTotal
if (items != 1) croak("epta!"); 0 4 4
36 4 ▶ auto name = xs::in<string_view>(ST(0));
Branch: 1 branch
BranchTrueFalseTotal
auto name = xs::in<string_view>(ST(0)); 4 0 4
37 4 ▶ Scope::Hints::remove(name);
Branch: 1 branch
BranchTrueFalseTotal
Scope::Hints::remove(name); 4 0 4
38 8 XSRETURN(0);
39 }
40  
41 3 static void xs_hints_get_hash (pTHX_ CV*) {
42 3 dVAR; dXSARGS;
43 3 ▶ if (items != 0) croak("epta!");
Branch: 1 branch
BranchTrueFalseTotal
if (items != 0) croak("epta!"); 0 3 3
44 3 ▶ auto ret = Scope::Hints::get();
Branch: 1 branch
BranchTrueFalseTotal
auto ret = Scope::Hints::get(); 3 0 3
45 3 ▶ EXTEND(SP, 1);
Branch: 2 branches
BranchTrueFalseTotal
EXTEND(SP, 1); 0 3 3
EXTEND(SP, 1); 0 0 0
46 3 ▶ ST(0) = Ref::create(ret).detach_mortal();
Branch: 2 branches
BranchTrueFalseTotal
ST(0) = Ref::create(ret).detach_mortal(); 3 0 3
ST(0) = Ref::create(ret).detach_mortal(); 3 0 3
47 6 XSRETURN(1);
48 3 }
49  
50 1 static void xs_hints_get_ct (pTHX_ CV*) {
51 1 dVAR; dXSARGS;
52 1 ▶ if (items != 1) croak("epta!");
Branch: 1 branch
BranchTrueFalseTotal
if (items != 1) croak("epta!"); 0 1 1
53 1 ▶ auto name = xs::in<string_view>(ST(0));
Branch: 1 branch
BranchTrueFalseTotal
auto name = xs::in<string_view>(ST(0)); 1 0 1
54 1 ▶ auto ret = Scope::Hints::get_ct(name);
Branch: 1 branch
BranchTrueFalseTotal
auto ret = Scope::Hints::get_ct(name); 1 0 1
55 1 ▶ ST(0) = ret.detach_mortal();
Branch: 1 branch
BranchTrueFalseTotal
ST(0) = ret.detach_mortal(); 1 0 1
56 2 XSRETURN(1);
57 1 }
58  
59 35 static bool init () {
60 35 auto file = "scope.cc";
61 35 newXS("MyTest::Hints::set", &xs_hints_set, file);
62 35 newXS("MyTest::Hints::exists", &xs_hints_exists, file);
63 35 newXS("MyTest::Hints::get", &xs_hints_get, file);
64 35 newXS("MyTest::Hints::remove", &xs_hints_remove, file);
65 35 newXS("MyTest::Hints::get_hash", &xs_hints_get_hash, file);
66 35 newXS("MyTest::Hints::get_ct", &xs_hints_get_ct, file);
67 35 return true;
68 }
69  
70 static bool _init = init();
« t/typemap/typemap_xsgen.cc ↑ Summary src/xs/Sv.cc »