aboutsummaryrefslogtreecommitdiff
path: root/test/bytes.tm
blob: a207c63379541ac37b94d784f66f47645b6c38bd (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

func main()
    say("Test bytes:")
    >> Byte(100)
    = Byte(0x64)

    >> Byte(0xFF)
    = Byte(0xFF)

    >> b := Byte(0x0F)
    >> b.hex()
    = "0F"
    >> b.hex(prefix=yes)
    = "0x0F"
    >> b.hex(uppercase=no)
    = "0f"

    >> Byte(0x06).get_bit(1)
    = no
    >> Byte(0x06).get_bit(2)
    = yes
    >> Byte(0x06).get_bit(3)
    = yes
    >> Byte(0x06).get_bit(4)
    = no