Skip to content

Commit

Permalink
Merge pull request #263 from tomhea/feature/new-gifs
Browse files Browse the repository at this point in the history
Feature/new gifs
  • Loading branch information
tomhea authored Dec 11, 2023
2 parents 93a8277 + adcde78 commit 67436d3
Show file tree
Hide file tree
Showing 16 changed files with 18 additions and 10 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: Tests

on: pull_request
on:
workflow_dispatch:
pull_request:
branches:
- main

env:
COLUMNS: 120
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ The operation takes 2 memory addresses - it flips (inverts) the bit the first ad
This project includes a **Macro Assembler**, an **Interpreter**, and a **Thoroughly Tested Standard Library** for the FlipJump language.
Additionally, it provides a [**Python Library**](https://pypi.org/project/flipjump/) that makes it easy to work with those components.

This calculator was built with only FlipJump ([source](programs/calc.fj)):
![Calculations using only FlipJump](res/calc.gif)
This prime numbers program was coded only with FlipJump ([source](programs/prime_sieve.fj)):
![Printing prime numbers using only FlipJump](resources/prime_sieve.gif)

## Hello, World!

Expand Down Expand Up @@ -117,7 +117,7 @@ Use the `fj` utility:
fj hello_world.fj
```

![Hello World in FlipJump](res/hello.gif)
![Hello World in FlipJump](resources/hello.gif)

- The --no-stl flag tells the assembler not to include the standard library. for example: `fj programs/print_tests/hello_no-stl.fj --no-stl`.
- the -w [WIDTH] flag allows compiling the .fj files to a WIDTH-bits memory width. WIDTH is 64 by default.
Expand Down
8 changes: 4 additions & 4 deletions flipjump/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ The assembler has 4 steps:
- writing the binary data into the executable ([fjm_writer.py](fjm/fjm_writer.py)).

The whole process is executed within the [assemble()](assembler/assembler.py) function.
![Assembly of calc.fj](../res/calc__asm.jpg)
![Assembly of calc.fj](../resources/calc__asm.jpg)

- The [ops.py](assembler/inner_classes/ops.py) file contains the classes of the different assembly ops.
- The [expr.py](assembler/inner_classes/expr.py) file contains the expression class (Expr), which is the code's representation of the assembly mathematical expressions. The expressions are based on numbers and labels.
Expand All @@ -22,7 +22,7 @@ The Interpreter ([fjm_run.py](interpretter/fjm_run.py)) stores the entire memory

The whole interpretation is done within the [run()](interpretter/fjm_run.py) function (also uses the [fjm_reader.py](fjm/fjm_reader.py) to read the fjm file - i.e. to get the flipjump program memory from the compiled fjm file).
More about [how to run](../README.md#how-to-run).
![Running the compiled calculator](../res/calc__run.jpg)
![Running the compiled calculator](../resources/calc__run.jpg)

### The Debugger

Expand All @@ -36,7 +36,7 @@ More about [how to debug](../README.md#how-to-debug).
The [macro_usage_graph.py](interpretter/debugging/macro_usage_graph.py) file exports a feature to present the macro-usage (which are the most used macros, and what % do they take from the overall flipjump ops) in a graph.
In order to view it, run the assembler with `--stats` (requires plotly to be installed (installed automatically with `pip install flipjump[stats]`)).
For example:
![The macro-usage statistics of calc.fj](../res/calc_stats.png)
![The macro-usage statistics of calc.fj](../resources/calc_stats.png)

## The Using-FlipJump Files

Expand Down Expand Up @@ -73,7 +73,7 @@ the short_file_name is (by default) s1,s2,s3,... for the standard library files
and f1,f2,f3,... for the compiled .fj files, in the order they are mentioned to the compiler (or appear in the test-line).

You can place breakpoints to stop on specific labels using the `-d`, followed by a `-b` and a label name (or `-B` and a part of a label name). For example:
![Debugging Demo](../res/breakpoint.jpg)
![Debugging Demo](../resources/breakpoint.jpg)

## More Files

Expand Down
Binary file removed res/calc.gif
Binary file not shown.
Binary file removed res/pytest.gif
Binary file not shown.
Binary file removed res/test_parallel.gif
Binary file not shown.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Binary file added resources/prime_sieve.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/pytest.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
Binary file added resources/test_parallel.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 6 additions & 2 deletions tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ The project has a CI tests suit, that runs on each pull-request (using [tox](htt
- They run for each os, with the latest supported python.
3. `pytest --all` in parallel.
- Runs on the latest supported python, on ubuntu.
- The results are printed as a table in the workflow summery ([for example](https://github.com/tomhea/flip-jump/actions/runs/7170673166/attempts/1#summary-19523946921)).

Any PR to the main branch must succeed in all of these tests, in order to be merged.

## Run the Linters
- `tox` - will run anything: all the linters + `pytest --regular` for all python versions + `pytest-all`.
Expand All @@ -28,13 +31,14 @@ Use `--regular` to run all the fast&medium tests.
**====> Use `--all` to run all the tests. <====**
The default (no type flags) means `--fast`.

![Running Pytest with --regular](../res/pytest.gif)
![Running Pytest with --regular](../resources/pytest.gif)

You can run the tests parallel with `-n auto` (using [xdist](https://github.com/pytest-dev/pytest-xdist)).
note that this option is only allowed while using exactly one of `--compile` / `--run`.
You can execute the `test_parallel` / `test_parallel.bat` to run parallel compile, and afterwords parallel run, with the given flags.

![Running the test_parallel script with --regular](../res/test_parallel.gif)
`test_parallel --all` example:
![Running the test_parallel script with --all, x4 speed](../resources/test_parallel.gif)

### Debugging info
When updating the codebase or adding new tests - Tests may fail, and it's a good thing. That way we can learn more about the code behavior.
Expand Down

0 comments on commit 67436d3

Please sign in to comment.