./
Coverage:
low: ≥ 0%
medium: ≥ 75.0%
high: ≥ 90.0%
Lines:
0 / 47
0.0%
Branches:
0 / 94
0.0%
Functions:
0 / 23
0.0%

apps/runner/src/eu/runner/script.base.cc
Line Branch Exec Source
1 #include "eu/runner/script.base.h"
2
3 #include "eu/runner/script.h"
4
5 namespace
6 {
7 template<typename T, typename F>
8 ✗ void bind_binary(lax::ClassAdder<T>* k, lax::Lax* lax, const char* const name, F op)
9 {
10
0/8
void (anonymous namespace)::bind_binary<eu::v3, eu::runner::register_vec3(lax::Lax*, lax::Scope*)::{lambda(eu::v3 const&, eu::v3 const&)#2}>(lax::ClassAdder<eu::v3>*, lax::Lax*, char const*, eu::runner::register_vec3(lax::Lax*, lax::Scope*)::{lambda(eu::v3 const&, eu::v3 const&)#2}):
✗ Branch 5 → 6 not taken.
✗ Branch 5 → 13 not taken.
✗ Branch 6 → 7 not taken.
✗ Branch 6 → 11 not taken.
void (anonymous namespace)::bind_binary<eu::v3, eu::runner::register_vec3(lax::Lax*, lax::Scope*)::{lambda(eu::v3 const&, eu::v3 const&)#1}>(lax::ClassAdder<eu::v3>*, lax::Lax*, char const*, eu::runner::register_vec3(lax::Lax*, lax::Scope*)::{lambda(eu::v3 const&, eu::v3 const&)#1}):
✗ Branch 5 → 6 not taken.
✗ Branch 5 → 13 not taken.
✗ Branch 6 → 7 not taken.
✗ Branch 6 → 11 not taken.
✗ k->add_static_function(name, [lax, op](lax::Callable*, lax::ArgumentHelper& arguments)->std::shared_ptr<lax::Object>
11 {
12
0/4
✗ Branch 4 → 5 not taken.
✗ Branch 4 → 29 not taken.
✗ Branch 5 → 6 not taken.
✗ Branch 5 → 27 not taken.
✗ auto lhs = arguments.require_native<T>("lhs");
13
0/4
✗ Branch 10 → 11 not taken.
✗ Branch 10 → 35 not taken.
✗ Branch 11 → 12 not taken.
✗ Branch 11 → 33 not taken.
✗ auto rhs = arguments.require_native<T>("rhs");
14
0/4
✗ Branch 14 → 15 not taken.
✗ Branch 14 → 39 not taken.
✗ Branch 15 → 16 not taken.
✗ Branch 15 → 18 not taken.
✗ if (arguments.complete())
15 {
16
0/2
✗ Branch 16 → 17 not taken.
✗ Branch 16 → 39 not taken.
✗ return lax::make_nil();
17 }
18
0/8
✗ Branch 18 → 19 not taken.
✗ Branch 18 → 39 not taken.
✗ Branch 19 → 20 not taken.
✗ Branch 19 → 39 not taken.
✗ Branch 20 → 21 not taken.
✗ Branch 20 → 39 not taken.
✗ Branch 21 → 22 not taken.
✗ Branch 21 → 39 not taken.
✗ return lax->make_native<T>(op(*lhs, *rhs));
19 ✗ });
20 ✗ }
21 }
22
23 namespace eu::runner
24 {
25 // todo(Gustav): add option to switch lax from double to float, or just switch to float and stop caring about doubles
26 ✗ float fl(lax::Tf d) { return static_cast<float>(d); }
27 ✗ lax::Tf lf(float f) { return static_cast<lax::Tf>(f); }
28
29 ✗ void register_vec3(lax::Lax* lax, lax::Scope* pkg)
30 {
31
0/2
✗ Branch 5 → 6 not taken.
✗ Branch 5 → 94 not taken.
✗ auto k = pkg->define_native_class<v3>("v3", [](auto& args)
32 {
33
0/4
✗ Branch 4 → 5 not taken.
✗ Branch 4 → 34 not taken.
✗ Branch 5 → 6 not taken.
✗ Branch 5 → 32 not taken.
✗ const auto x = fl(args.require_float("x"));
34
0/4
✗ Branch 11 → 12 not taken.
✗ Branch 11 → 40 not taken.
✗ Branch 12 → 13 not taken.
✗ Branch 12 → 38 not taken.
✗ const auto y = fl(args.require_float("y"));
35
0/4
✗ Branch 18 → 19 not taken.
✗ Branch 18 → 46 not taken.
✗ Branch 19 → 20 not taken.
✗ Branch 19 → 44 not taken.
✗ const auto z = fl(args.require_float("z"));
36
0/2
✗ Branch 24 → 25 not taken.
✗ Branch 24 → 28 not taken.
✗ if (args.complete())
37 {
38 ✗ return v3{ 0,0,0 };
39 }
40 ✗ return v3{ x, y, z };
41
0/2
✗ Branch 6 → 7 not taken.
✗ Branch 6 → 92 not taken.
✗ });
42
0/4
✗ Branch 14 → 15 not taken.
✗ Branch 14 → 104 not taken.
✗ Branch 15 → 16 not taken.
✗ Branch 15 → 102 not taken.
✗ k.add_property<lax::Tf>("x",
43 ✗ [](const v3& v) -> lax::Tf{ return lf(v.x); },
44 ✗ [](auto& v, lax::Tf value) { v.x = fl(value); }
45 );
46
0/4
✗ Branch 24 → 25 not taken.
✗ Branch 24 → 118 not taken.
✗ Branch 25 → 26 not taken.
✗ Branch 25 → 116 not taken.
✗ k.add_property<lax::Tf>("y",
47 ✗ [](const v3& v) -> lax::Tf{ return lf(v.y); },
48 ✗ [](auto& v, lax::Tf value) { v.y = fl(value); }
49 );
50
0/4
✗ Branch 34 → 35 not taken.
✗ Branch 34 → 132 not taken.
✗ Branch 35 → 36 not taken.
✗ Branch 35 → 130 not taken.
✗ k.add_property<lax::Tf>("z",
51 ✗ [](const v3& v) -> lax::Tf{ return lf(v.z); },
52 ✗ [](auto& v, lax::Tf value) { v.z = fl(value); }
53 );
54
0/2
✗ Branch 40 → 41 not taken.
✗ Branch 40 → 204 not taken.
✗ bind_binary(&k, lax, lax::named::functions::add, [](const v3& lhs, const v3& rhs) { return lhs + rhs; });
55
0/2
✗ Branch 41 → 42 not taken.
✗ Branch 41 → 204 not taken.
✗ bind_binary(&k, lax, lax::named::functions::sub, [](const v3& lhs, const v3& rhs) { return lhs - rhs; });
56
57
0/4
✗ Branch 45 → 46 not taken.
✗ Branch 45 → 146 not taken.
✗ Branch 46 → 47 not taken.
✗ Branch 46 → 144 not taken.
✗ pkg->add_native_getter("up", [lax] {return lax->make_native(kk::up);});
58
0/4
✗ Branch 53 → 54 not taken.
✗ Branch 53 → 156 not taken.
✗ Branch 54 → 55 not taken.
✗ Branch 54 → 154 not taken.
✗ pkg->add_native_getter("down", [lax] {return lax->make_native(kk::down); });
59
0/4
✗ Branch 61 → 62 not taken.
✗ Branch 61 → 166 not taken.
✗ Branch 62 → 63 not taken.
✗ Branch 62 → 164 not taken.
✗ pkg->add_native_getter("left", [lax] {return lax->make_native(kk::left); });
60
0/4
✗ Branch 69 → 70 not taken.
✗ Branch 69 → 176 not taken.
✗ Branch 70 → 71 not taken.
✗ Branch 70 → 174 not taken.
✗ pkg->add_native_getter("right", [lax] {return lax->make_native(kk::right); });
61
0/4
✗ Branch 77 → 78 not taken.
✗ Branch 77 → 186 not taken.
✗ Branch 78 → 79 not taken.
✗ Branch 78 → 184 not taken.
✗ pkg->add_native_getter("in", [lax] {return lax->make_native(kk::in); });
62
0/4
✗ Branch 85 → 86 not taken.
✗ Branch 85 → 196 not taken.
✗ Branch 86 → 87 not taken.
✗ Branch 86 → 194 not taken.
✗ pkg->add_native_getter("out", [lax] {return lax->make_native(kk::out); });
63 ✗ }
64
65 ✗ void register_base(Script* script)
66 {
67
0/4
✗ Branch 4 → 5 not taken.
✗ Branch 4 → 14 not taken.
✗ Branch 5 → 6 not taken.
✗ Branch 5 → 12 not taken.
✗ auto pkg = script->lax.in_package("eu");
68
0/2
✗ Branch 9 → 10 not taken.
✗ Branch 9 → 18 not taken.
✗ register_vec3(&script->lax, pkg.get());
69 ✗ }
70
71 }
72