on c19b2a8 help sign in
40 lines 1.0 kB history raw
1/*
2^- @ux
3%- jam
4=> [40 2]
5!=
6=- (add +< +>)
7|%
8++ add
9 |= [a=@ b=@]
10 ?~ a
11 b
12 $(a (dec a), b +(b))
13++ dec
14 |= a=@
15 =| i=@
16 |-
17 =+ n=+(i)
18 ?: =(n a)
19 i
20 $(i n)
21--
22*/
23var compiler = require('../compiler.js'),
24 serial = require('../serial.js'),
25 noun = require('../noun.js'),
26 test = require('tape'),
27 tchk = require('tape-check'),
28 BigInteger = require('jsbn').BigInteger,
29 check = tchk.check,
30 gen = tchk.gen,
31 n = noun.dwim,
32 pill = noun.Atom.fromString("829878621bce21b21920c888730c9059367e61cfcc39f98721920f9099110dd6986c86483c425fa84c8886dc2ec3b1330b26e2c9b478d937168f1b26e4e1887ab8e61b213c612cc4b21920fc4dc324164d5912c86483a425c21362dc2ec38b4e2c9ae2b041", 16),
33 formula = serial.cue(pill),
34 small = gen.intWithin(0,128),
35 context = new compiler.Context();
37test("nock add", check(small, small, function(t, a, b) {
38 t.plan(1);
39 t.equal(context.nock(n(a,b), formula).valueOf(), a + b, "a+b");
40}));