-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.fif
executable file
·146 lines (114 loc) · 5.31 KB
/
test.fif
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
#!/usr/bin/env fift -s
//
// Following tests assume that https://github.com/ton-blockchain/ton/pull/60
// is applied.
//
"common.fif" include
init_test
// add some test domains
"телеграм" 1 100 gen-test-addr domain_upsert 0 assert_eq
"yandex" 3 123 gen-test-addr domain_upsert 0 assert_eq
"stas" 1 124 gen-test-addr domain_upsert 0 assert_eq
"zevlg" 1 125 gen-test-addr domain_upsert 0 assert_eq
"yandex" 2 126 gen-test-addr domain_upsert 0 assert_eq
"faraway" -1 999 gen-test-addr domain_upsert 0 assert_eq
"faraway" 1 900 gen-test-addr domain_upsert 0 assert_eq
"" 2 303 gen-test-addr domain_upsert 35 assert_eq drop dec-mtdns-seqno
<b "db1" $, 0 8 u, "msk" $, 0 8 u, "yandex" $, b> <s 1 400 gen-test-addr
domain_upsert_slice 0 assert_eq
<b "khv" $, 0 8 u, "yandex" $, b> <s 1 401 gen-test-addr
domain_upsert_slice 0 assert_eq
<b "🦆" $, 0 8 u, "farm" $, b> <s 1 700 gen-test-addr
domain_upsert_slice 0 assert_eq
<b "" { "x" $+ } 126 times $, b> <s 1 800 gen-test-addr
domain_upsert_slice 0 assert_eq
<b "" { "x" $+ } 127 times $, b> <s 1 900 gen-test-addr
domain_upsert_slice 35 assert_eq drop dec-mtdns-seqno
// resolve domains
"yandex" 3 get_dnsresolve 0 assert_eq 123 gen-test-addr assert_eq2 48 assert_eq
"yandex" 2 get_dnsresolve 0 assert_eq 126 gen-test-addr assert_eq2 48 assert_eq
"stas" 1 get_dnsresolve 0 assert_eq 124 gen-test-addr assert_eq2 32 assert_eq
"zevlg" 1 get_dnsresolve 0 assert_eq 125 gen-test-addr assert_eq2 40 assert_eq
"телеграм" 1 get_dnsresolve 0 assert_eq 100 gen-test-addr assert_eq2 128 assert_eq
<b "db1" $, 0x0 8 u, "msk" $, 0x0 8 u, "yandex" $, b> <s 1
get_dnsresolve_slice 0 assert_eq 400 gen-test-addr assert_eq2 112 assert_eq
<b "db2" $, 0x0 8 u, "msk" $, 0x0 8 u, "yandex" $, b> <s 3
get_dnsresolve_slice 0 assert_eq 123 gen-test-addr assert_eq2 48 assert_eq
<b "db2" $, 0x0 8 u, "khv" $, 0x0 8 u, "yandex" $, b> <s 1
get_dnsresolve_slice 0 assert_eq 401 gen-test-addr assert_eq2 80 assert_eq
<b "🦆" $, 0 8 u, "farm" $, b> <s 1
get_dnsresolve_slice 0 assert_eq 700 gen-test-addr assert_eq2 72 assert_eq
<b "🐷" $, 0 8 u, "farm" $, b> <s 1
get_dnsresolve_slice 0 assert_eq assert_null 0 assert_eq
<b "" { "x" $+ } 127 times $, b> <s 1
get_dnsresolve_slice_noparse 35 assert_eq drop
<b "" $, b> <s 1
get_dnsresolve_slice_noparse 35 assert_eq drop
<b "xxx" $, b> <s -2
get_dnsresolve_slice_noparse 36 assert_eq drop
"..." 1 get_dnsresolve 0 assert_eq assert_null 0 assert_eq
"." 1 get_dnsresolve 0 assert_eq assert_null 0 assert_eq
// all records for a given domain
"yandex" get_dnsresolve_all 0 assert_eq 48 assert_eq
// -1 shadows all categories
"faraway" 1 get_dnsresolve 0 assert_eq 999 gen-test-addr assert_eq2 56 assert_eq
"faraway" 2 get_dnsresolve 0 assert_eq 999 gen-test-addr assert_eq2 56 assert_eq
<b "db" $, 0x0 8 u, "faraway" $, b> <s 3
get_dnsresolve_slice 0 assert_eq 999 gen-test-addr assert_eq2 56 assert_eq
<b "mx" $, 0x0 8 u, "attic" $, 0x0 8 u, "faraway" $, b> <s 4
get_dnsresolve_slice 0 assert_eq 999 gen-test-addr assert_eq2 56 assert_eq
// update
"uptest" 1 123 gen-test-addr domain_upsert 0 assert_eq
"uptest" 1 223 gen-test-addr domain_upsert 0 assert_eq
"uptest" 1 get_dnsresolve 0 assert_eq 223 gen-test-addr assert_eq2 48 assert_eq
// delete test
"deltest1" 1 100 gen-test-addr domain_upsert 0 assert_eq
"deltest1" 2 200 gen-test-addr domain_upsert 0 assert_eq
"deltest1" 3 300 gen-test-addr domain_upsert 0 assert_eq
"deltest1" 0 domain_delete 0 assert_eq
"deltest1" 1 get_dnsresolve 0 assert_eq assert_null 0 assert_eq
"deltest1" 2 get_dnsresolve 0 assert_eq assert_null 0 assert_eq
"deltest1" 4 get_dnsresolve 0 assert_eq assert_null 0 assert_eq
"deltest2" 1 100 gen-test-addr domain_upsert 0 assert_eq
"deltest2" 2 200 gen-test-addr domain_upsert 0 assert_eq
"deltest2" 2 domain_delete 0 assert_eq
"deltest2" 2 get_dnsresolve 0 assert_eq assert_null 0 assert_eq
"deltest2" 1 get_dnsresolve 0 assert_eq 100 gen-test-addr assert_eq2 64 assert_eq
"deltest3" 1 100 gen-test-addr domain_upsert 0 assert_eq
"deltest3" 2 200 gen-test-addr domain_upsert 0 assert_eq
"deltest3" 2 domain_delete 0 assert_eq
"deltest3" 1 domain_delete 0 assert_eq
"deltest3" 2 get_dnsresolve 0 assert_eq assert_null 0 assert_eq
// ownership transfer
variable new-pubkey
variable new-privkey
newkeypair new-pubkey ! new-privkey !
new-pubkey @ mtdns_transfer 0 assert_eq
// should work
"телеграм" 1 get_dnsresolve 0 assert_eq 100 gen-test-addr assert_eq2 128 assert_eq
// should fail with old sig
"telegram" 1 100 gen-test-addr domain_upsert 34 assert_eq drop dec-mtdns-seqno
new-pubkey @ mtdns-pubkey !
new-privkey @ mtdns-privkey !
// should work now
"telegram" 1 4242 gen-test-addr domain_upsert 0 assert_eq
"telegram" 1 get_dnsresolve 0 assert_eq 4242 gen-test-addr assert_eq2 64 assert_eq
// code upgrade
get_version 0 assert_eq triple third 1 assert_eq
"mtdns.fif" include mtdns_upgrade 0 assert_eq
// get seqno
get_seqno 0 assert_eq drop
// unknown op exception
mtdns_unknown_op 50 assert_eq drop dec-mtdns-seqno
// wrong seqno
dec-mtdns-seqno
"телеграм" 1 get_dnsresolve 0 assert_eq 100 gen-test-addr assert_eq2 128 assert_eq
"telega" 1 400 gen-test-addr domain_upsert 33 assert_eq drop
"telega" 1 400 gen-test-addr domain_upsert 0 assert_eq
."DONE" cr
// full manage
// Makefile
// 32 bit workchains
// ldaddr again?
// long opcodes?
// var -> type