Skip to content

Commit 656efd2

Browse files
committed
Added more examples\
1 parent e07f1b3 commit 656efd2

File tree

4 files changed

+17
-1
lines changed

4 files changed

+17
-1
lines changed

squirrel/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<img src="https://raw.githubusercontent.com/rtoal/polyglot/master/docs/+resources/squirrel-logo-64.png">
1+
<img src="https://raw.githubusercontent.com/rtoal/polyglot/master/docs/resources/squirrel-logo-64.png">
22

33
# Squirrel Explorations:
44

squirrel/clockhands_time.nut

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
for (local i = 0 ; i < 11 ; i++)
2+
{
3+
local t = (43200 * i + 21600) / 11
4+
printf("%02d:%02d:%02d\n", date(t, 'u').hour || 12, date(t).min, date(t).sec)
5+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
print((0.1 + 0.2 == 0.3) + "\n") // Outputs true
2+
print((0.01 + 0.02 == 0.03) + "\n") // Outputs true
3+
print((0.001 + 0.002 == 0.003) + "\n") // Outputs true
4+
print((0.0001 + 0.0002 == 0.0003) + "\n") // Outputs false
5+
print((0.00001 + 0.00002 == 0.00003) + "\n") // Outputs true
6+
print((0.000001 + 0.000002 == 0.000003) + "\n") // Outputs true
7+
print((0.0000001 + 0.0000002 == 0.0000003) + "\n") // Outputs true

squirrel/test.ps1

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,13 @@ function Assert-MatchTests {
99
}
1010

1111
$Error.clear()
12+
sq "$PSScriptRoot\clockhands_time.nut" |
13+
Compare-Object (Get-Content "$PSScriptRoot\..\test\clockhands_expected") |
14+
Assert-MatchTests &&
1215
sq "$PSScriptRoot\clockhands.nut" |
1316
Compare-Object (Get-Content "$PSScriptRoot\..\test\clockhands_expected") |
1417
Assert-MatchTests &&
18+
sq "$PSScriptRoot\floating_point_mystery.nut" &&
1519
sq "$PSScriptRoot\hello.nut" &&
1620
sq "$PSScriptRoot\triple.nut" |
1721
Compare-Object (Get-Content "$PSScriptRoot\..\test\triple_expected") |

0 commit comments

Comments
 (0)