@hummus-1/constant-folding
v1.1.1
Published
Constant Folding javascript code
Downloads
2
Maintainers
Readme
constant-folding
Installation
npm install @hummus-1/constant-folding
Usage as executable:
cf input_file output_file
The output file must be created before running the executable
Usage from code:
const constantFolding = require('constant-folding');
//call the function with the string containing the code
The documentation of the function.
Examples
hoid@Urithiru:~/Uni/Tercero/PL/Constant Folding/constant-folding-module$ cf input.txt output
File read succesfully
Output written succesfully in output.js
Author
alu0101353340
Tests
npm test
PASS test/test.js
Normal operations
✓ Works correctly with product and declaration (6 ms)
✓ Works correctly with division and declaration (1 ms)
✓ Works correctly with substraction (1 ms)
Array operations
Can access array position correctly
✓ With positive values (1 ms)
✓ With negative values (1 ms)
✓ With text literals (1 ms)
✓ With an operation inside
Length method
✓ With a normal array (1 ms)
✓ With an empty array (1 ms)
Array methods that return a literal
✓ Works with join methods and no arguments (1 ms)
✓ Works with join methods with an argument (1 ms)
✓ Works with shift method (1 ms)