Skip to content

Commit a36ba3e

Browse files
committed
typo. also theta => radius (rusty math)
1 parent 7a203f4 commit a36ba3e

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

examples/rubyish/t/inheritance.t

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class Point
1111
def x; @x ; end
1212
def y; @y ; end
1313

14-
def theta; (x * @x + y * @y) ** 0.5; end
14+
def radius; (x * @x + y * @y) ** 0.5; end
1515
end
1616

1717
class Point3D < Point
@@ -23,7 +23,7 @@ class Point3D < Point
2323

2424
def z; @z ; end
2525

26-
def theta; (x * @x + y * @y + z * @z) ** 0.5; end
26+
def radius; (x * @x + y * @y + z * @z) ** 0.5; end
2727
end
2828

2929
obj_2d = Point.new(10, 20)
@@ -32,12 +32,12 @@ obj_3d = Point3D.new(15, 25, 35)
3232
puts "#{obj_2d.x == 10 ? 'ok' : 'nok'} 4 - 2d obj x"
3333
puts "#{obj_2d.y == 20 ? 'ok' : 'nok'} 5 - 2d obj y"
3434

35-
t2 = obj_2d.theta
36-
puts "#{t2 > 22 && t2 < 23 ? 'ok' : 'nok'} 6 - theta 2d (approx)"
35+
t2 = obj_2d.radius
36+
puts "#{t2 > 22 && t2 < 23 ? 'ok' : 'nok'} 6 - radius 2d (approx)"
3737

3838
puts "#{obj_3d.x == 15 ? 'ok' : 'nok'} 7 - 3d obj x"
3939
puts "#{obj_3d.y == 25 ? 'ok' : 'nok'} 8 - 3d obj y"
4040
puts "#{obj_3d.z == 35 ? 'ok' : 'nok'} 9 - 3d obj z"
4141

42-
t3 = obj_3d.theta
43-
puts "#{t3 > 45 && t2 < 46 ? 'ok' : 'nok'} 10 - theta 3d (approx)"
42+
t3 = obj_3d.radius
43+
puts "#{t3 > 45 && t3 < 46 ? 'ok' : 'nok'} 10 - radius 3d (approx)"

0 commit comments

Comments
 (0)