Skip to main content

module lang::flybytes::tests::ArrayTests

rascal-0.40.17
flybytes-0.2.8

Usage

import lang::flybytes::tests::ArrayTests;

Source code

http://github.com/usethesource/flybytes/blob/main/src/lang/flybytes/tests/ArrayTests.rsc

Dependencies

import lang::flybytes::Syntax;
import lang::flybytes::Compiler;
import Node;
import List;

function primArrayTestClass

Class primArrayTestClass(Type t, int len)

function defVal

Exp defVal(integer())

Exp defVal(long())

Exp defVal(byte())

Exp defVal(character())

Exp defVal(short())

Exp defVal(object(str _))

Exp defVal(array(Type _))

Exp defVal(string())

Exp defVal(boolean())

function testArrayClass

bool testArrayClass(Class c)

function valArrayTestClass

Class valArrayTestClass(Type t, int len, Exp val)

function initArrayTestClass

Class initArrayTestClass(Type t, list[Exp] values, Exp val)

Tests

test primitiveArrays10

test bool primitiveArrays10() 
= all( t <- primTypes, testArrayClass(primArrayTestClass(t, 10)));

test primitiveArrays0

test bool primitiveArrays0() 
= all( t <- primTypes, testArrayClass(primArrayTestClass(t, 0)));

test primitiveArrays1

test bool primitiveArrays1() 
= all( t <- primTypes, testArrayClass(primArrayTestClass(t, 1)));

test boolArrayTrue1

test bool boolArrayTrue1() 
= testArrayClass(valArrayTestClass(boolean(), 1, \true()));

test boolArrayFalse1

test bool boolArrayFalse1() 
= testArrayClass(valArrayTestClass(boolean(), 1, \false()));

test boolArrayFalse10

test bool boolArrayFalse10() 
= testArrayClass(valArrayTestClass(boolean(), 10, \false()));

test boolInitArrayTrue

test bool boolInitArrayTrue() 
= testArrayClass(initArrayTestClass(integer(), [iconst(10), iconst(20), iconst(30)], \true()));