Skip to content
This repository
branch: master
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 61 lines (52 sloc) 1.832 kb
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
let assert = require("assert");

extern describe, it;

describe('Machine Types', function() {
  it('u8', function () {
    let u8 x; assert (x === 0);
    x = 1; assert (x === 1);
    x = -1; assert (x === 0xff);
    x = 0xff; assert (x === 0xff);
    x += 1; assert (x === 0);
                      assert (sizeof(u8) === 1);
  });

  it('i8', function () {
    let i8 x; assert (x === 0);
    x = 1; assert (x === 1);
    x = -1; assert (x === -1);
    x = 0xff; assert (x === -1);
    x += 1; assert (x === 0);
                      assert (sizeof(i8) === 1);
  });


  it('u16', function () {
    let u16 x; assert (x === 0);
    x = 1; assert (x === 1);
    x = -1; assert (x === 0xffff);
    x = 0xffff; assert (x === 0xffff);
    x += 1; assert (x === 0);
                      assert (sizeof(u16) === 2);
  });

  it('i16', function () {
    let i16 x; assert (x === 0);
    x = 1; assert (x === 1);
    x = -1; assert (x === -1);
    x = 0xffff; assert (x === -1);
    x += 1; assert (x === 0);
                      assert (sizeof(i16) === 2);
  });

  it('u32', function () {
    let u32 x; assert (x === 0);
    x = 1; assert (x === 1);
    x = -1; assert (x === 0xffffffff);
    x = 0xffffffff; assert (x === 0xffffffff);
    x += 1; assert (x === 0);
                      assert (sizeof(u32) === 4);
  });

  it('i32', function () {
    let i32 x; assert (x === 0);
    x = 1; assert (x === 1);
    x = -1; assert (x === -1);
    x = 0xffffffff; assert (x === -1);
    x += 1; assert (x === 0);
                      assert (sizeof(i32) === 4);
  });

});
Something went wrong with that request. Please try again.