Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/juandac/monty_test
https://github.com/juandac/monty_test
Last synced: about 7 hours ago
JSON representation
- Host: GitHub
- URL: https://github.com/juandac/monty_test
- Owner: JuanDAC
- Created: 2021-05-12T12:44:01.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-05-21T22:50:00.000Z (over 2 years ago)
- Last Synced: 2023-08-03T19:57:30.736Z (over 1 year ago)
- Language: MATLAB
- Size: 79.1 KB
- Stars: 10
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Test for monty
> Unit test for monty project## Install
1. Clone the repo inside your project.
```console
git clone https://github.com/JuanDAC/monty_test.git
```## Create a new unittest
The unittest is compose by 2 files, and `*.m` file and
`expected-*` output.The first must be in the root directory in the path `bytecodes/.m`
and the second must be in the `test/expected-out/expected-`the code and the output must have the same name. But the first one with the
suffix `.m` and the second one with the prefix `expected-`### Example
for the demo file `000.m` the expected file must be `expected-000`
and the path distributions must be
```console
foo@bar[monty]$ tree .
.
├── bytecodes
│ ├── 000.m <- Monty code 000.m
│ └── README.md
├── main.c
├── makefile
├── monty.h
├── README.md
└── test
├── expected-out
│ └── expected-000 <- Expected output for 000.m
├── makefile
├── README.md
├── test <- compilated program
├── test-all <- script-for-unit-tests
└── tmp
└── stdout-000 <- temporal-file-for-000.m
...
```## How to use
* Move to the folder.
```
cd monty_test
```There are 2 ways to run the test-all script. The first one
is without arguments### Run without args
```console
foo@bar$ ./test-all
NO ARGS
NO ARGS
0-add.m: OK
0-comments.m: OK
0-div.m: OK
0-mul.m: OK
0-nop.m: OK
0-pchar.m: FAILED.
0-pint.m: OK
```r { color: Red }
m { color: Magenta }
g { color: Green }It will show the files and the status code.
- OK: Expected result.
- FAILED: It is not the expected result.
- NO_REF: There is no file to be compared.If the output and the expected are equals the code should
be OKIf the output and the expected are diferents. The code
should be FAILED.If the expected is not found The code sould be NO_REF.
### Run with args
If you run the command with a `` as argument
the script will search this file in the bytecode folder
and show
- `ARGS` in the first line
- The file name and the test code in the second line
- A horizonal line
- _`[GOT]`_ output of the `` througt your program
- The *Output* of program
- _`[EXPECTED]`_
- Expected output```console
foo@bar$ ./test-all 2-pupa.m
ARGS
2-pupa.m: OK
------------------
[GOT]
3
2
1
[EXPECTED]
3
2
1
------------------
```