diff options
| author | s-ol <s-ol@users.noreply.github.com> | 2020-05-10 14:25:09 +0000 |
|---|---|---|
| committer | s-ol <s-ol@users.noreply.github.com> | 2020-05-10 14:37:22 +0000 |
| commit | 966eef2d6557eeffc5b5c7b379efc1f2e7d0de0b (patch) | |
| tree | 524d983750073d17a8adfed2c90550ebd0e0501f /spec | |
| parent | add and test Type:eq(a,b) (diff) | |
| download | alive-966eef2d6557eeffc5b5c7b379efc1f2e7d0de0b.tar.gz alive-966eef2d6557eeffc5b5c7b379efc1f2e7d0de0b.zip | |
make <num! 4> == <num= 4>
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/result/sig_spec.moon | 11 | ||||
| -rw-r--r-- | spec/type_spec.moon | 13 |
2 files changed, 22 insertions, 2 deletions
diff --git a/spec/result/sig_spec.moon b/spec/result/sig_spec.moon index 4d04b9c..6e9a11c 100644 --- a/spec/result/sig_spec.moon +++ b/spec/result/sig_spec.moon @@ -1,5 +1,5 @@ import do_setup from require 'spec.test_setup' -import SigStream, RTNode, Scope, SimpleRegistry, T from require 'alv' +import SigStream, Constant, RTNode, Scope, SimpleRegistry, T from require 'alv' import Op, Builtin from require 'alv.base' class TestOp extends Op @@ -51,6 +51,15 @@ describe 'SigStream', -> assert.is.equal (SigStream T.num, 3), val assert.not.equal (SigStream T.num, 4), val + it 'can be compared to a Constant', -> + val = SigStream T.num, 3 + assert.is.equal (Constant.num 3), val + assert.not.equal (Constant.num 4), val + + val = SigStream T.str, 'hello' + assert.is.equal (Constant.str 'hello'), val + assert.not.equal (Constant.sym 'hello'), val + describe ':set', -> it 'sets the value', -> val = SigStream T.num, 3 diff --git a/spec/type_spec.moon b/spec/type_spec.moon index a435067..b6315f1 100644 --- a/spec/type_spec.moon +++ b/spec/type_spec.moon @@ -1,11 +1,15 @@ require 'spec.test_setup' -import T, Primitive, Array, Struct from require 'alv' +import T, Type, Primitive, Array, Struct from require 'alv.type' +import ancestor from require 'alv.util' bool = Primitive 'bool' num = Primitive 'num' str = Primitive 'str' describe 'Primitive', -> + it 'inherits from Type', -> + assert.is.equal Type, ancestor Primitive.__class + it 'stringifies well', -> assert.is.equal 'bool', tostring bool assert.is.equal 'num', tostring num @@ -35,6 +39,10 @@ describe 'Primitive', -> describe 'Array', -> vec3 = Array 3, num str32 = Array 2, Array 3, str + + it 'inherits from Type', -> + assert.is.equal Type, ancestor Array.__class + it 'stringifies well', -> assert.is.equal 'num[3]', tostring vec3 assert.is.equal 'my-type[3][24]', tostring Array 24, Array 3, 'my-type' @@ -65,6 +73,9 @@ describe 'Struct', -> play = Struct { note: str, dur: num } abc = Struct { c: num, b: num, a: num } + it 'inherits from Type', -> + assert.is.equal Type, ancestor Struct.__class + it 'stringifies well', -> assert.is.equal '{dur: num note: str}', tostring play assert.is.equal '{a: num b: num c: num}', tostring abc |
