move to test folder and fix import bug in shell

This commit is contained in:
2023-03-20 00:17:43 +00:00
parent b56c1fc485
commit 4a320008b2
9 changed files with 37 additions and 8 deletions

19
tests/example.ar Normal file
View File

@@ -0,0 +1,19 @@
let getInitials(name) = do
name = name.upper()
namesplit = name.split(" ")
i = 0
while (i < namesplit.length) do
namesplit[i] = namesplit[i][0]
i = i + 1
return namesplit.join("")
name = "william bell"
term.log(getInitials(name))
term.log(name)
let addLastName(name) = do
name.append(" Bell")
name = "William"
addLastName(name)
term.log(name)

10
tests/makerandom.ar Normal file
View File

@@ -0,0 +1,10 @@
y = []
i = 0
while (i<1000000) do
y.append(random())
if (i % 100000 == 0) term.log(i)
i = i + 1
term.time("write")
open("array.json", "w").json(y)
term.timeEnd("write")

3
tests/test.ar Normal file
View File

@@ -0,0 +1,3 @@
import "csv" as csv
term.log(csv.read("tests/test.csv"))

2
tests/test.csv Normal file
View File

@@ -0,0 +1,2 @@
hello,world
1,2,3,4,5,6,7,8,9,10
1 hello,world
2 1,2,3,4,5,6,7,8,9,10

14
tests/thread.ar Normal file
View File

@@ -0,0 +1,14 @@
f() = do
term.log("Hello, world!")
term.time("threaded function")
for (i from 0 to 1000000) do
if (i % 100000 == 0) do
term.log("i = " + i)
term.timeEnd("threaded function")
term.log("Goodbye, world!")
t = thread(f)
t.start()
term.time("main thread")
t.join()
term.timeEnd("main thread")