Adding testing
This commit is contained in:
parent
97861dc3f3
commit
c571d32ef2
15
README.md
15
README.md
@ -4,16 +4,17 @@ Ronin is a graphic design tool under development.
|
|||||||
|
|
||||||
<img src='https://raw.githubusercontent.com/hundredrabbits/Ronin/master/PREVIEW.jpg' width='600'/>
|
<img src='https://raw.githubusercontent.com/hundredrabbits/Ronin/master/PREVIEW.jpg' width='600'/>
|
||||||
|
|
||||||
## Themes
|
## Electron Build
|
||||||
|
|
||||||
Drag a .thm file on the window to install it.
|
```
|
||||||
|
cd desktop
|
||||||
## Controls
|
npm install
|
||||||
|
npm start
|
||||||
<img src='https://cdn.rawgit.com/hundredrabbits/Ronin/master/LAYOUT.svg?v=1' width="600"/>
|
```
|
||||||
|
|
||||||
## Extras
|
## Extras
|
||||||
|
|
||||||
- Download additional [themes](https://github.com/hundredrabbits/Themes).
|
- This application supports the [Ecosystem Theme](https://github.com/hundredrabbits/Themes).
|
||||||
- Support this project through [Patreon](https://patreon.com/100).
|
- Support this project through [Patreon](https://patreon.com/100).
|
||||||
- See the [License](LICENSE.md) file for license rights and limitations (MIT).
|
- See the [License](LICENSE.md) file for license rights and limitations (MIT).
|
||||||
|
- Pull Requests are welcome!
|
||||||
|
@ -60,7 +60,7 @@ function Theme (_default) {
|
|||||||
e.stopPropagation()
|
e.stopPropagation()
|
||||||
const file = e.dataTransfer.files[0]
|
const file = e.dataTransfer.files[0]
|
||||||
if (!file || !file.name) { console.warn('Theme', 'Unnamed file.'); return }
|
if (!file || !file.name) { console.warn('Theme', 'Unnamed file.'); return }
|
||||||
if (file.name.indexOf('.thm') < 0 && file.name.indexOf('.svg') < 0) { console.warn('Theme', 'Skipped, not a theme'); return }
|
if (file.name.indexOf('.thm') < 0 && file.name.indexOf('.svg') < 0) { return }
|
||||||
const reader = new FileReader()
|
const reader = new FileReader()
|
||||||
reader.onload = function (e) {
|
reader.onload = function (e) {
|
||||||
themer.load(e.target.result)
|
themer.load(e.target.result)
|
||||||
|
@ -131,11 +131,6 @@ function Library (ronin) {
|
|||||||
return rect
|
return rect
|
||||||
}
|
}
|
||||||
|
|
||||||
this.echo = function (any) {
|
|
||||||
console.log(any)
|
|
||||||
return any
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
this.of = function (h, k) {
|
this.of = function (h, k) {
|
||||||
@ -171,4 +166,20 @@ function Library (ronin) {
|
|||||||
this.step = function (val, step) {
|
this.step = function (val, step) {
|
||||||
return Math.round(val / step) * step
|
return Math.round(val / step) * step
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Generics
|
||||||
|
|
||||||
|
this.echo = function (...args) {
|
||||||
|
console.log(args.reduce((acc, val) => { return acc + val + ' ' }, ''))
|
||||||
|
return args
|
||||||
|
}
|
||||||
|
|
||||||
|
this.test = function (name, a, b) {
|
||||||
|
if (a !== b) {
|
||||||
|
console.warn('failed ' + name, a, b)
|
||||||
|
} else {
|
||||||
|
console.log('passed ' + name, a, b)
|
||||||
|
}
|
||||||
|
return a === b
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ function Lisp (input, lib) {
|
|||||||
run: (input, context) => {
|
run: (input, context) => {
|
||||||
const file = fs.readFileSync(
|
const file = fs.readFileSync(
|
||||||
path.resolve(input[1].value),
|
path.resolve(input[1].value),
|
||||||
{encoding: "utf-8"})
|
{ encoding: 'utf-8' })
|
||||||
|
|
||||||
return interpret(this.parse(file), context)
|
return interpret(this.parse(file), context)
|
||||||
},
|
},
|
||||||
|
16
examples/benchmark.lisp
Normal file
16
examples/benchmark.lisp
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
; benchmark
|
||||||
|
|
||||||
|
(
|
||||||
|
; Basics
|
||||||
|
|
||||||
|
(test "add" (add 8 4 2) 14)
|
||||||
|
(test "sub" (sub 8 4 2) 2)
|
||||||
|
(test "mul" (mul 8 4 2) 64)
|
||||||
|
(test "div" (div 8 4 2) 1)
|
||||||
|
|
||||||
|
; Others
|
||||||
|
|
||||||
|
(test "mod" (mod 6 4) 2)
|
||||||
|
(test "clamp" (clamp 12 4 8) 8)
|
||||||
|
(test "step" (step 12 10) 10)
|
||||||
|
)
|
Loading…
x
Reference in New Issue
Block a user