Skip to content

Test cases for loops #54

Open
Open
@Zomis

Description

@Zomis

It would be nice to be able to test that loops do what they are supposed to do

As a simple example consider the code:

$ nextLoop 'testable-loop'
[+++>++>-]

and the DSL:

$ {
     test 'testable-loop' memory '3 x4 5 2 0 1' expect '3 7 7 1 0 x0'
     test 'testable-loop' memory '3 x4 5 2 0 2 0 1' expect '3 7 7 1 0 4 2 x0'
}

x indicates the memory cell pointer.

Both the above tests should then pass.

Could be useful to test some loops in http://codereview.stackexchange.com/q/57382/31562 , for example to perform one fizz-buzz loop, process one Fizz, etc.

This has potential to be extended quite a bit, for example with expect *, asserting that pointer never leaves the allocated memory, and probably more.

Named memory cells might be useful for parts of this ( #14 )

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions