-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathtests.js
77 lines (59 loc) · 1.57 KB
/
tests.js
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
$(document).ready(function() {
test("1 + 1 = ?", function() {
ok( 2, "this test is fine" );
var value = 1+1;
equals( 2, value, "We expect value to be 2" );
});
test("b36(-435)", function() {
var value = b36(-435);
equals('-c3', value, "Expected -c3");
});
test("folder name -13", function() {
var value = posfolder(-13);
equals("1f", value, "Expected 1f");
});
test("folder name 44", function() {
var value = posfolder(44);
equals("18", value, "Expected 18");
});
test("-435.mod(64)", function() {
var value = (-435).mod(64);
equals(13, value, "Expected 13");
});
test("NBT readBytes 1", function() {
var value = [0];
var tagReader = new NBTReader(value);
equals(tagReader.readBytes(1),0);
});
test("get_ms1bit(254)", function() {
equals(get_ms1bit(254), 128);
});
test("makesigned(254)", function() {
var value = makeSigned(254);
equals(value, -2,"");
});
test("makeshort(0 1)", function() {
var arr = [0, 1];
var value = makeshort(arr);
equals(value,1, "");
});
test("makeshort(0 254)", function() {
var arr = [0, 254];
var value = makeshort(arr);
equals(value, -2,'');
});
test("TAG_Long", function() {
var arr = [0x04, 0x00, 0x04, 0x54, 0x69, 0x6D, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x68, 0x40];
var nbtreader = new NBTReader(arr);
var value = nbtreader.read();
equals(value.Time,1206336);
});
test("TAG_Compound", function() {
// var data =
});
$.get('getlevel.php', function(data) {
var arr = JSON.parse(data);
var nbtreader = new NBTReader(arr);
$('#extra').append(JSON.stringify(nbtreader.read()));
});
});