-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
sergei.winitzki
committed
Nov 29, 2023
1 parent
d096f8b
commit 2113768
Showing
6 changed files
with
41 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
def staggeredFactorial(n: Int): Int = (n to 1 by -2).product | ||
|
||
// scala> staggeredFactorial(8) | ||
// res7: Int = 384 | ||
assert(staggeredFactorial(8) == 384) |
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
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,35 @@ | ||
# Copy solutions to source files. | ||
for chapter in chapter[0-9][0-9]; do | ||
|
||
cat <<EOF1 > $chapter/src/test/scala/sofp/unit/Solutions.scala | ||
package sofp.unit | ||
import com.eed3si9n.expecty.Expecty.expect | ||
import munit.FunSuite | ||
class WorksheetsTest extends FunSuite { | ||
EOF1 | ||
for worksheet in $chapter/worksheets/*.scala; do | ||
|
||
cat <<EOF2 >> $chapter/src/test/scala/sofp/unit/Solutions.scala | ||
test("verify $worksheet") { | ||
EOF2 | ||
|
||
cat $worksheet >> $chapter/src/test/scala/sofp/unit/Solutions.scala | ||
|
||
cat <<EOF3 >> $chapter/src/test/scala/sofp/unit/Solutions.scala | ||
} | ||
EOF3 | ||
|
||
done | ||
|
||
cat <<EOF4 >> $chapter/src/test/scala/sofp/unit/Solutions.scala | ||
} | ||
EOF4 | ||
|
||
done | ||
|
||
sbt "$@" |