Skip to content

Commit

Permalink
tcl/difference-of-squares: 2nd iteration
Browse files Browse the repository at this point in the history
  • Loading branch information
vpayno committed Apr 16, 2024
1 parent 94142e3 commit 78f9a8e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 23 deletions.
4 changes: 2 additions & 2 deletions tcl/difference-of-squares/difference-of-squares.tcl
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
proc squareOfSum {number} {
return [expr ($number * ($number + 1) / 2) ** 2]
return [expr {($number * ($number + 1) / 2) ** 2}]
}

proc sumOfSquares {number} {
return [expr ($number * ($number + 1) * (2 * $number + 1) / 6)]
return [expr {$number * ($number + 1) * (2 * $number + 1) / 6}]
}

proc differenceOfSquares {number} {
Expand Down
37 changes: 16 additions & 21 deletions tcl/difference-of-squares/run-tests-tcl.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,48 +21,43 @@ warn: parsing /home/vpayno/git_vpayno/exercism-workspace/tcl/difference-of-squar
/home/vpayno/git_vpayno/exercism-workspace/tcl/difference-of-squares/testHelpers.tcl: errors file: 1
warn: parsing /home/vpayno/git_vpayno/exercism-workspace/tcl/difference-of-squares/difference-of-squares.tcl
/home/vpayno/git_vpayno/exercism-workspace/tcl/difference-of-squares/difference-of-squares.tcl: parsing file /home/vpayno/git_vpayno/exercism-workspace/tcl/difference-of-squares/difference-of-squares.tcl
/home/vpayno/git_vpayno/exercism-workspace/tcl/difference-of-squares/difference-of-squares.tcl:2: possible unintended double substitution for expr use {} <<($number>>
/home/vpayno/git_vpayno/exercism-workspace/tcl/difference-of-squares/difference-of-squares.tcl:6: possible unintended double substitution for expr use {} <<($number>>
/home/vpayno/git_vpayno/exercism-workspace/tcl/difference-of-squares/difference-of-squares.tcl:13: expect variable 'square' as 'numeric' but is 'string {}' <<$square>>
/home/vpayno/git_vpayno/exercism-workspace/tcl/difference-of-squares/difference-of-squares.tcl:13: expect variable 'sum' as 'numeric' but is 'string {}' <<$sum>>
/home/vpayno/git_vpayno/exercism-workspace/tcl/difference-of-squares/difference-of-squares.tcl: errors file: 4
errors all: 5 (13.89% lines)
lines: 36 in: 00:00:00 59 lines/sec: 610.17
/home/vpayno/git_vpayno/exercism-workspace/tcl/difference-of-squares/difference-of-squares.tcl:2: error in expression missing operator <<**>>
/home/vpayno/git_vpayno/exercism-workspace/tcl/difference-of-squares/difference-of-squares.tcl: errors file: 1
errors all: 2 (5.56% lines)
lines: 36 in: 00:00:00 60 lines/sec: 600.00
commands: 5 variables: 1
signature params 9 unknown: 5 55.56% unknown variables 0.00%
signature params 9 unknown: 3 33.33% unknown variables 0.00%

real 0m0.127s
user 0m0.103s
sys 0m0.025s
real 0m0.112s
user 0m0.100s
sys 0m0.013s

===============================================================================

Running: nagelfar -s _ ./difference-of-squares.tcl
Checking file ./difference-of-squares.tcl
Line 2: W Expr without braces
Line 6: W Expr without braces

real 0m0.034s
user 0m0.026s
sys 0m0.007s
real 0m0.032s
user 0m0.027s
sys 0m0.004s

===============================================================================

Running: RUN_ALL=1 tclsh ./difference-of-squares.test
difference-of-squares.test: Total 9 Passed 9 Skipped 0 Failed 0

real 0m0.010s
user 0m0.008s
sys 0m0.002s
user 0m0.006s
sys 0m0.004s


===============================================================================

Running: misspell .

real 0m0.019s
user 0m0.023s
sys 0m0.008s
real 0m0.020s
user 0m0.017s
sys 0m0.012s

===============================================================================

0 comments on commit 78f9a8e

Please sign in to comment.