-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tcl/difference-of-squares: 1st iteration
- Loading branch information
Showing
4 changed files
with
84 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,14 @@ | ||
proc squareOfSum {n} { | ||
throw {NOT_IMPLEMENTED} "Implement this procedure." | ||
proc squareOfSum {number} { | ||
return [expr ($number * ($number + 1) / 2) ** 2] | ||
} | ||
|
||
proc sumOfSquares {n} { | ||
throw {NOT_IMPLEMENTED} "Implement this procedure." | ||
proc sumOfSquares {number} { | ||
return [expr ($number * ($number + 1) * (2 * $number + 1) / 6)] | ||
} | ||
|
||
proc differenceOfSquares {n} { | ||
throw {NOT_IMPLEMENTED} "Implement this procedure." | ||
proc differenceOfSquares {number} { | ||
set square [squareOfSum $number] | ||
set sum [sumOfSquares $number] | ||
|
||
return [expr {$square - $sum}] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
Running automated test file(s): | ||
|
||
|
||
=============================================================================== | ||
|
||
Running: ttclcheck -scan /home/vpayno/git_vpayno/exercism-workspace/tcl/difference-of-squares | ||
ttclcheck version: 0.18 Copyright 2013 Artur Trzewik | ||
All Rights Reserved. | ||
|
||
GPL licensed software | ||
warn: pass shallow | ||
warn: parsing /home/vpayno/git_vpayno/exercism-workspace/tcl/difference-of-squares/testHelpers.tcl | ||
warn: parsing /home/vpayno/git_vpayno/exercism-workspace/tcl/difference-of-squares/difference-of-squares.tcl | ||
warn: pass collect | ||
warn: parsing /home/vpayno/git_vpayno/exercism-workspace/tcl/difference-of-squares/testHelpers.tcl | ||
warn: parsing /home/vpayno/git_vpayno/exercism-workspace/tcl/difference-of-squares/difference-of-squares.tcl | ||
warn: pass report | ||
warn: parsing /home/vpayno/git_vpayno/exercism-workspace/tcl/difference-of-squares/testHelpers.tcl | ||
/home/vpayno/git_vpayno/exercism-workspace/tcl/difference-of-squares/testHelpers.tcl: parsing file /home/vpayno/git_vpayno/exercism-workspace/tcl/difference-of-squares/testHelpers.tcl | ||
/home/vpayno/git_vpayno/exercism-workspace/tcl/difference-of-squares/testHelpers.tcl:17: unknown variable ::tcltest::numTests <<$::tcltest::numTests>> | ||
/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 | ||
commands: 5 variables: 1 | ||
signature params 9 unknown: 5 55.56% unknown variables 0.00% | ||
|
||
real 0m0.127s | ||
user 0m0.103s | ||
sys 0m0.025s | ||
|
||
=============================================================================== | ||
|
||
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 | ||
|
||
=============================================================================== | ||
|
||
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 | ||
|
||
|
||
=============================================================================== | ||
|
||
Running: misspell . | ||
|
||
real 0m0.019s | ||
user 0m0.023s | ||
sys 0m0.008s | ||
|
||
=============================================================================== | ||
|