@@ -14,21 +14,21 @@ use std::collections::HashMap;
1414
1515static TEST_CASES : & str = r#"
1616lognot ( 1 2 3 ) => FAIL
17- lognot 0xff => null
18- lognot 0xffffff => null
17+ lognot 0xff => 0
18+ lognot 0xffffff => 0
1919lognot 0x0000ff => 0xff00
2020lognot 0x0000000001 => 0xfe
2121lognot 0xff00 => 0x00ff
2222lognot 0x0c => 0xf3
23- lognot null => 0xff
23+ lognot 0 => 0xff
2424lognot 0xcccccc => 0x333333
2525lognot 0x333333 => 0xcccccc
2626; requires exactly one argument
2727lognot 0x00 0x00 => FAIL
2828lognot => FAIL
2929
3030logior ( 1 2 3 ) => FAIL
31- logior => null
31+ logior => 0
3232logior 0xbaadf00d => 0xbaadf00d
3333logior 0xf0 0x0f => 0xff
3434logior 0xcc 0x33 => 0xff
@@ -45,7 +45,7 @@ logior 0x01 0x01 => 0x01
4545logxor 0x01 0x01 0x01 => 0x01
4646
4747logxor ( 1 2 3 ) => FAIL
48- logxor => null
48+ logxor => 0
4949logxor 0xbaadf00d => 0xbaadf00d
5050logxor 0xf0 0x0f => 0xff
5151logxor 0xcc 0x33 => 0xff
@@ -58,25 +58,25 @@ logxor 0x000080 0x7f => 0x00ff
5858logxor 0x000070 0xff => 0x8f
5959logxor 0xffff80 0x01 => 0x81
6060logxor 0x01 0x02 0x04 0x08 0x10 0x20 0x40 0x80 => 0xff
61- logxor 0x01 0x01 => null
61+ logxor 0x01 0x01 => 0
6262logxor 0x01 0x01 0x01 => 0x01
6363
6464logand ( 1 2 3 ) => FAIL
6565logand => 0xff
6666logand 0xbaadf00d => 0xbaadf00d
67- logand 0xf0 0x0f => null
68- logand 0xcc 0x33 => null
69- logand 0x800000 0x01 => null
70- logand 0x400000 0x01 => null
71- logand 0x000040 0x01 => null
72- logand 0x000080 0x01 => null
67+ logand 0xf0 0x0f => 0
68+ logand 0xcc 0x33 => 0
69+ logand 0x800000 0x01 => 0
70+ logand 0x400000 0x01 => 0
71+ logand 0x000040 0x01 => 0
72+ logand 0x000080 0x01 => 0
7373; 0x000080 -> 0x0080, 0xff -> 0xffff
7474logand 0x000080 0xff => 0x0080
7575logand 0x000040 0xff => 0x40
76- logand 0x000080 0x7f => null
76+ logand 0x000080 0x7f => 0
7777logand 0x000070 0xff => 0x70
78- logand 0xffff80 0x01 => null
79- logand 0x01 0x02 0x04 0x08 0x10 0x20 0x40 0x80 => null
78+ logand 0xffff80 0x01 => 0
79+ logand 0x01 0x02 0x04 0x08 0x10 0x20 0x40 0x80 => 0
8080logand 0x01 0x01 => 0x01
8181logand 0x01 0x01 0x01 => 0x01
8282
@@ -103,8 +103,8 @@ ash 0x7f -3 => 0x0f
103103ash 0x7f -4 => 0x07
104104ash 0x7f -5 => 0x03
105105ash 0x7f -6 => 0x01
106- ash 0x7f -7 => null
107- ash 0x7f -8 => null
106+ ash 0x7f -7 => 0
107+ ash 0x7f -8 => 0
108108
109109ash 0x80 1 => 0xff00
110110ash 0x80 2 => 0xfe00
@@ -170,16 +170,16 @@ lsh 0x80 -4 => 0x08
170170lsh 0x80 -5 => 0x04
171171lsh 0x80 -6 => 0x02
172172lsh 0x80 -7 => 0x01
173- lsh 0x80 -8 => null
173+ lsh 0x80 -8 => 0
174174
175175lsh 0x7f -1 => 0x3f
176176lsh 0x7f -2 => 0x1f
177177lsh 0x7f -3 => 0x0f
178178lsh 0x7f -4 => 0x07
179179lsh 0x7f -5 => 0x03
180180lsh 0x7f -6 => 0x01
181- lsh 0x7f -7 => null
182- lsh 0x7f -8 => null
181+ lsh 0x7f -7 => 0
182+ lsh 0x7f -8 => 0
183183
184184lsh 0x80 1 => 0x0100
185185lsh 0x80 2 => 0x0200
@@ -224,7 +224,7 @@ lsh 0xcc 65536 => FAIL
224224lsh 0xcc -65536 => FAIL
225225lsh 0xcc 256 => 0x00cc0000000000000000000000000000000000000000000000000000000000000000
226226lsh 0xcc 255 => 0x660000000000000000000000000000000000000000000000000000000000000000
227- lsh 0xcc -256 => null
227+ lsh 0xcc -256 => 0
228228
229229; parameter isn't allowed to be wider than 32 bits
230230lsh 0xcc 0x0000000001 => FAIL
@@ -233,109 +233,109 @@ lsh 0xcc "foo" => FAIL
233233not => FAIL
234234not 1 2 => FAIL
235235not 0 => 1
236- not 1 => null
237- not 0xffff => null
238- not null => 1
236+ not 1 => 0
237+ not 0xffff => 0
238+ not 0 => 1
239239; a sigle zero-byte counts as true
240- not 0x00 => null
240+ not 0x00 => 0
241241
242242; a non-empty list counts as "true"
243- not ( 1 2 3 ) => null
243+ not ( 1 2 3 ) => 0
244244not ( ) => 1
245245
246- any => null
247- any null => null
248- any 1 null => 1
249- any null 1 => 1
246+ any => 0
247+ any 0 => 0
248+ any 1 0 => 1
249+ any 0 1 => 1
250250; a sigle zero-byte counts as true
251251any 0x00 => 1
252252
253253; a non-empty list counts as "true"
254- any null ( 1 2 ) => 1
254+ any 0 ( 1 2 ) => 1
255255any ( ) ( 1 2 ) => 1
256- any ( ) null => null
256+ any ( ) 0 => 0
257257
258258all => 1
259- all null => null
260- all 1 null => null
261- all null 1 => null
259+ all 0 => 0
260+ all 1 0 => 0
261+ all 0 1 => 0
262262all 1 2 3 => 1
263263all 0x00 => 1
264- all 0x00 null => null
264+ all 0x00 0 => 0
265265
266266; a non-empty list counts as "true"
267267all ( 1 ) 2 3 => 1
268- all ( 1 ) 2 ( ) => null
268+ all ( 1 ) 2 ( ) => 0
269269
270270x => FAIL
271271x ( "msg" ) => FAIL
272272x "error_message" => FAIL
273273
274274> => FAIL
275- > null => FAIL
276- > null null => null
275+ > 0 => FAIL
276+ > 0 0 => 0
277277
278- ; 0 and null are the same
279- > 0 null => null
280- > null 0 => null
278+ ; 0 and 0 are the same
279+ > 0 0 => 0
280+ > 0 0 => 0
281281
282282> ( 1 0 ) => FAIL
283283> ( 1 ) 0 => FAIL
284284> 0 ( 1 ) => FAIL
285285> 1 0 => 1
286- > 0 1 => null
286+ > 0 1 => 0
287287> 0 -1 => 1
288- > -1 0 => null
288+ > -1 0 => 0
289289> 0x0000000000000000000000000000000000000000000000000000000000000000000493e0 0x000000000000000000000000000000000000000000000000000000000000005a => 1
290- > 3 300 => null
290+ > 3 300 => 0
291291> 300 3 => 1
292292> "foobar" "foo" => 1
293293> "foo" "boo" => 1
294- > "bar" "foo" => null
294+ > "bar" "foo" => 0
295295
296296>s => FAIL
297297>s 0x00 => FAIL
298- >s 0x00 0x00 => null
298+ >s 0x00 0x00 => 0
299299>s 0x00 0x00 0x00 => FAIL
300300>s ( 1 ) ( 2 ) => FAIL
301301>s "foo" ( 2 ) => FAIL
302302>s ( 2 ) "foo" => FAIL
303303
304304; -1 is 0xff which compares greater than 0, an empty atom
305305>s -1 0 => 1
306- >s 0 -1 => null
306+ >s 0 -1 => 0
307307>s 0x01 0x00 => 1
308308>s 0x1001 0x1000 => 1
309- >s 0x1000 0x1001 => null
309+ >s 0x1000 0x1001 => 0
310310>s "foo" "bar" => 1
311- >s "bar" "foo" => null
312- >s "foo" "foo" => null
311+ >s "bar" "foo" => 0
312+ >s "foo" "foo" => 0
313313
314314= => FAIL
315315= 0x00 => FAIL
316316= 0x00 0x00 0x00 => FAIL
317317= ( "foo" ) "foo" => FAIL
318318= "foo" ( "foo" ) => FAIL
319319
320- = null null => 1
320+ = 0 0 => 1
321321= 1 1 => 1
322- = 0 null => 1
323- = 0 0x00 => null
324- = 0x00 0 => null
325- = 0xff 0xffff => null
322+ = 0 0 => 1
323+ = 0 0x00 => 0
324+ = 0x00 0 => 0
325+ = 0xff 0xffff => 0
326326= -1 -1 => 1
327327= 1 1 => 1
328328= 256 256 => 1
329- = 255 -1 => null
330- = 65535 -1 => null
329+ = 255 -1 => 0
330+ = 65535 -1 => 0
331331= 65535 65535 => 1
332332= 65536 65536 => 1
333333= 4294967295 4294967295 => 1
334334= 4294967296 4294967296 => 1
335335= 2147483647 2147483647 => 1
336336= 2147483648 2147483648 => 1
337337= 0x00000000000000000000000000000000000000000000000000000010 0x00000000000000000000000000000000000000000000000000000010 => 1
338- = 0x00000000000000000000000000000000000000000000000000000010 0x00000000000000000000000000000000000000000000000000000020 => null
338+ = 0x00000000000000000000000000000000000000000000000000000010 0x00000000000000000000000000000000000000000000000000000020 => 0
339339
340340+ ( 1 ) => FAIL
341341+ 1 ( 2 ) => FAIL
@@ -519,15 +519,15 @@ softfork ( 50 ) => FAIL
519519softfork 0 => FAIL
520520softfork -1 => FAIL
521521
522- softfork 50 => null
523- softfork 51 110 => null
522+ softfork 50 => 0
523+ softfork 51 110 => 0
524524softfork => FAIL
525- softfork 3121 => null
526- softfork 0x00000000000000000000000000000000000050 => null
525+ softfork 3121 => 0
526+ softfork 0x00000000000000000000000000000000000050 => 0
527527softfork 0xffffffffffffffff => FAIL
528528; technically, this is a valid cost, but it still exceeds the limit we set for the tests
529529softfork 0xffffffffffffff => FAIL
530- softfork null => FAIL
530+ softfork 0 => FAIL
531531
532532strlen => FAIL
533533strlen ( "list" ) => FAIL
@@ -605,7 +605,7 @@ i 1 1 => FAIL
605605i 1 1 1 1 => FAIL
606606i 1 "true" "false" => "true"
607607i 0 "true" "false" => "false"
608- i null "true" "false" => "false"
608+ i 0 "true" "false" => "false"
609609i "" "true" "false" => "false"
610610i 10 "true" "false" => "true"
611611i -1 "true" "false" => "true"
@@ -623,12 +623,12 @@ c => FAIL
623623c 1 => FAIL
624624c 1 ( 2 ) "garbage" => FAIL
625625c 1 ( 2 ) => ( 1 2 )
626- c null ( 2 ) => ( null 2 )
626+ c 0 ( 2 ) => ( 0 2 )
627627c 1 2 => ( 1 . 2 )
628628c 1 ( 2 3 4 ) => ( 1 2 3 4 )
629629c ( 1 2 3 ) ( 4 5 6 ) => ( ( 1 2 3 ) 4 5 6 )
630630
631- f null => FAIL
631+ f 0 => FAIL
632632f 1 => FAIL
633633f ( 1 2 3 ) 1 => FAIL
634634f ( 1 2 3 ) => 1
@@ -637,24 +637,24 @@ f ( ( 1 2 ) 3 ) => ( 1 2 )
637637r 1 => FAIL
638638r => FAIL
639639r ( 1 2 3 ) 12 => FAIL
640- r null => FAIL
640+ r 0 => FAIL
641641r ( 1 2 3 ) => ( 2 3 )
642642r ( 1 . 2 ) => 2
643643
644644l => FAIL
645645l ( 1 2 ) 1 => FAIL
646646l ( 1 2 3 ) => 1
647647l 1 => 0
648- l null => null
649- l ( null . null ) => 1
648+ l 0 => 0
649+ l ( 0 . 0 ) => 1
650650l ( 1 . 2 ) => 1
651651
652652point_add 0x97f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb 0xa572cbea904d67468808c8eb50a9450c9721db309128012543902d0ac358a62ae28f75bb8f1c7c42c39a8c5529bf0f4e => 0x89ece308f9d1f0131765212deca99697b112d61f9be9a5f1f3780a51335b3ff981747a0b2ca2179b96d2c0c9024e5224
653653point_add => 0xc00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
654654; the point must be 40 bytes
655655point_add 0x97f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6 => FAIL
656656point_add 0x97f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb00 => FAIL
657- point_add null => FAIL
657+ point_add 0 => FAIL
658658
659659; the point must be an atom
660660point_add ( 1 2 3 ) => FAIL
@@ -682,7 +682,7 @@ pubkey_for_exp 0x8c1258acd66282b7ccc627f7f65e27faac425bfd0001a401000000000000000
682682"# ;
683683
684684fn parse_atom ( a : & mut Allocator , v : & str ) -> NodePtr {
685- if v == "null " {
685+ if v == "0 " {
686686 return a. null ( ) ;
687687 }
688688
0 commit comments