Skip to content
This repository
Browse code

More test cases.

commit 241d48bc0531ae2ec1e43e05e55f29516f70e5ba 1 parent 6d07130
Michael Bebenita authored

Showing 2 changed files with 31 additions and 4 deletions. Show diff stats Hide diff stats

  1. +3 2 README.md
  2. +28 2 test/arrays.ljs
5 README.md
Source Rendered
@@ -48,8 +48,9 @@ enable it with:
48 48 Testing
49 49 =======
50 50
51   -To run the tests install [Mocha](http://visionmedia.github.com/mocha/) and [Should.js](https://github.com/visionmedia/should.js) Node modules. Then run:
  51 +To run the tests install the [Mocha](http://visionmedia.github.com/mocha/) module then run:
52 52
53   - mocha --compilers ljs:ljc --require should
  53 + export NODE_PATH=src/
  54 + mocha --compilers ljs:ljc
54 55
55 56 from the root LLJS directory.
30 test/arrays.ljs
... ... @@ -1,6 +1,6 @@
1 1 let assert = require("assert");
2 2
3   -extern describe, it;
  3 +extern describe, it, console;
4 4
5 5 describe('Arrays', function() {
6 6 function testElements(int * a, int length) {
@@ -22,6 +22,32 @@ describe('Arrays', function() {
22 22 let int a [1024];
23 23 testElements(a, 1024);
24 24 });
25   -});
26 25
  26 + it('int', function () {
  27 + let int a [1024];
  28 + testElements(a, 1024);
  29 + });
  30 +});
27 31
  32 +describe('Stack Arrays', function() {
  33 + it('u8', function () {
  34 + let u8 a [1024];
  35 + a[42] = 42;
  36 + assert (a[42] === 42);
  37 + assert (*(a + 42) === 42);
  38 + a[42] = 0xFFAD;
  39 + assert (*(a + 42) === 0xAD);
  40 + a[12] = -1;
  41 + assert (a[12] === 255);
  42 + });
  43 + it('i8', function () {
  44 + let i8 a [1024];
  45 + a[42] = -42;
  46 + assert (a[42] === -42);
  47 + assert (*(a + 42) === -42);
  48 + *(a + 42) = 0xFFAE;
  49 + assert (*(a + 42) === -82);
  50 + a[12] = -1;
  51 + assert (a[12] === -1);
  52 + });
  53 +});

0 comments on commit 241d48b

Please sign in to comment.
Something went wrong with that request. Please try again.