• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

rokucommunity / brs / #294

24 Apr 2023 07:40PM UTC coverage: 91.705% (+5.4%) from 86.275%
#294

push

web-flow
Merge pull request #1 from rokucommunity/adoption

refactor in preparation for adoption the project

1736 of 2013 branches covered (86.24%)

Branch coverage included in aggregate %.

5152 of 5498 relevant lines covered (93.71%)

8882.84 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

95.45
/src/brsTypes/components/RoInt.ts
1
import { BrsComponent } from "./BrsComponent";
138✔
2
import { BrsValue, ValueKind, BrsString, BrsBoolean, BrsInvalid, Comparable } from "../BrsType";
138✔
3
import { Callable, StdlibArgument } from "../Callable";
138✔
4
import { Interpreter } from "../../interpreter";
5
import { BrsType } from "..";
6
import { Unboxable } from "../Boxing";
7
import { Int32 } from "../Int32";
8

9
export class roInt extends BrsComponent implements BrsValue, Unboxable {
138✔
10
    readonly kind = ValueKind.Object;
43✔
11
    private intrinsic: Int32;
12

13
    public getValue(): Int32 {
14
        return this.intrinsic;
4✔
15
    }
16

17
    constructor(initialValue: Int32) {
18
        super("roInt");
43✔
19

20
        this.intrinsic = initialValue;
43✔
21
        this.registerMethods({
43✔
22
            ifInt: [this.getInt, this.setInt],
23
            ifToStr: [this.toStr],
24
            // Per https://developer.roku.com/docs/references/brightscript/interfaces/ifintops.md,
25
            // ifIntOps _also_ implements toStr()
26
            ifIntOps: [this.toStr],
27
        });
28
    }
29

30
    unbox() {
31
        return this.intrinsic;
6✔
32
    }
33

34
    equalTo(other: BrsType): BrsBoolean {
35
        if (other instanceof roInt) {
7✔
36
            return BrsBoolean.from(other.intrinsic.getValue() === this.intrinsic.getValue());
7✔
37
        }
38

39
        return BrsBoolean.False;
×
40
    }
41

42
    toString(_parent?: BrsType): string {
43
        return this.intrinsic.toString();
2✔
44
    }
45

46
    // ---------- ifInt ----------
47

48
    private getInt = new Callable("getInt", {
43✔
49
        signature: {
50
            args: [],
51
            returns: ValueKind.Double,
52
        },
53
        impl: (interpreter: Interpreter) => {
54
            return this.intrinsic;
4✔
55
        },
56
    });
57

58
    private setInt = new Callable("setInt", {
43✔
59
        signature: {
60
            args: [new StdlibArgument("value", ValueKind.Int32)],
61
            returns: ValueKind.Void,
62
        },
63
        impl: (_interpreter, value: Int32) => {
64
            this.intrinsic = value;
2✔
65
            return BrsInvalid.Instance;
2✔
66
        },
67
    });
68

69
    // ---------- ifIntOps, ifToStr ----------
70

71
    private toStr = new Callable("toStr", {
43✔
72
        signature: {
73
            args: [],
74
            returns: ValueKind.String,
75
        },
76
        impl: (interpreter: Interpreter) => {
77
            return new BrsString(this.intrinsic.toString());
12✔
78
        },
79
    });
80
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc