Skip to content

Commit b63d23c

Browse files
author
Victor kariuki
committed
Merge remote-tracking branch 'origin/main'
2 parents d0ea599 + bebdea8 commit b63d23c

File tree

3 files changed

+20
-7
lines changed

3 files changed

+20
-7
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ To get started download the executables from the release page or follow the inst
2121
- Download the binary:
2222

2323
```
24-
curl -O -L https://github.com/AvicennaJr/Nuru/releases/download/v0.5.15/nuru_Linux_amd64.tar.gz
24+
curl -O -L https://github.com/AvicennaJr/Nuru/releases/download/v0.5.16/nuru_Linux_amd64.tar.gz
2525
```
2626

2727
- Extract the file to make global available:
@@ -44,13 +44,13 @@ nuru -v
4444
- For apple silicon mac use:
4545

4646
```
47-
curl -O -L https://github.com/AvicennaJr/Nuru/releases/download/v0.5.15/nuru_Darwin_arm64.tar.gz
47+
curl -O -L https://github.com/AvicennaJr/Nuru/releases/download/v0.5.16/nuru_Darwin_arm64.tar.gz
4848
```
4949

5050
- For apple intel mac use:
5151

5252
```
53-
curl -O -L https://github.com/AvicennaJr/Nuru/releases/download/v0.5.15/nuru_Darwin_amd64.tar.gz
53+
curl -O -L https://github.com/AvicennaJr/Nuru/releases/download/v0.5.16/nuru_Darwin_amd64.tar.gz
5454
```
5555
5656
- Extract the file to make global available:
@@ -78,7 +78,7 @@ nuru -v
7878
- Download the binary with this command:
7979
8080
```
81-
curl -O -L https://github.com/AvicennaJr/Nuru/releases/download/v0.5.15/nuru_Android_arm64.tar.gz
81+
curl -O -L https://github.com/AvicennaJr/Nuru/releases/download/v0.5.16/nuru_Android_arm64.tar.gz
8282
```
8383
- Extract the file:
8484
@@ -99,7 +99,7 @@ nuru -v
9999
### Windows
100100
101101
- Executable:
102-
- Download the Nuru zip file [Here](https://github.com/AvicennaJr/Nuru/releases/download/v0.5.15/nuru_Windows_amd64.zip)
102+
- Download the Nuru zip file [Here](https://github.com/AvicennaJr/Nuru/releases/download/v0.5.16/nuru_Windows_amd64.zip)
103103
- Unzip to get the executable
104104
- Double click the executable
105105

evaluator/evaluator_test.go

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ func TestEvalIntegerExpression(t *testing.T) {
2222
{"5 + 5 + 5 + 5 - 10", 10},
2323
{"2 * 2 * 2 * 2", 16},
2424
{"2 / 2 + 1", 2},
25-
{"2**3", 8},
2625
}
2726

2827
for _, tt := range tests {
@@ -31,6 +30,20 @@ func TestEvalIntegerExpression(t *testing.T) {
3130
}
3231
}
3332

33+
func TestEvalFloatExpression(t *testing.T) {
34+
tests := []struct {
35+
input string
36+
expected float64
37+
}{
38+
{"2**3", 8.0},
39+
}
40+
41+
for _, tt := range tests {
42+
evaluated := testEval(tt.input)
43+
testFloatObject(t, evaluated, tt.expected)
44+
}
45+
}
46+
3447
func TestEvalBooleanExpression(t *testing.T) {
3548
tests := []struct {
3649
input string

evaluator/infix.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ func evalIntegerInfixExpression(operator string, left, right object.Object, line
219219
case "*":
220220
return &object.Integer{Value: leftVal * rightVal}
221221
case "**":
222-
return &object.Integer{Value: int64(math.Pow(float64(leftVal), float64(rightVal)))}
222+
return &object.Float{Value: float64(math.Pow(float64(leftVal), float64(rightVal)))}
223223
case "/":
224224
x := float64(leftVal) / float64(rightVal)
225225
if math.Mod(x, 1) == 0 {

0 commit comments

Comments
 (0)