Update.
This commit is contained in:
Vendored
+31
@@ -0,0 +1,31 @@
|
||||
// retoor <retoor@molodetz.nl>
|
||||
|
||||
import "bytes" for Bytes
|
||||
|
||||
System.print(Bytes.length("Hello")) // expect: 5
|
||||
System.print(Bytes.length("")) // expect: 0
|
||||
|
||||
System.print(Bytes.toList("AB")) // expect: [65, 66]
|
||||
System.print(Bytes.toList("")) // expect: []
|
||||
|
||||
System.print(Bytes.fromList([65, 66, 67])) // expect: ABC
|
||||
System.print(Bytes.fromList([])) // expect:
|
||||
|
||||
System.print(Bytes.concat("Hello", " World")) // expect: Hello World
|
||||
System.print(Bytes.concat("", "Test")) // expect: Test
|
||||
System.print(Bytes.concat("Test", "")) // expect: Test
|
||||
|
||||
System.print(Bytes.slice("Hello", 0, 2)) // expect: He
|
||||
System.print(Bytes.slice("Hello", 2, 5)) // expect: llo
|
||||
System.print(Bytes.slice("Hello", 0, 100)) // expect: Hello
|
||||
System.print(Bytes.length(Bytes.slice("Hello", 10, 20))) // expect: 0
|
||||
|
||||
var mask = Bytes.fromList([0xFF, 0xFF, 0xFF, 0xFF])
|
||||
var data = Bytes.fromList([0, 1, 2, 3])
|
||||
var xored = Bytes.xorMask(data, mask)
|
||||
System.print(Bytes.toList(xored)) // expect: [255, 254, 253, 252]
|
||||
|
||||
var mask2 = Bytes.fromList([0x12, 0x34])
|
||||
var data2 = Bytes.fromList([0, 0, 0, 0])
|
||||
var xored2 = Bytes.xorMask(data2, mask2)
|
||||
System.print(Bytes.toList(xored2)) // expect: [18, 52, 18, 52]
|
||||
Reference in New Issue
Block a user