1
1
Fork 0

Removed the remaining untestable tasks from 'Summary 1'

This commit is contained in:
Svetlana Isakova 2019-10-21 14:07:02 +02:00
parent 3855cae763
commit 649e548a25
61 changed files with 674 additions and 794 deletions

View File

@ -1 +1,11 @@
package summaryIExercise1
package summaryIExercise1
fun main() {
var x = 1
val y = x
val z = y
x = 2
println(x)
println(y)
println(z)
}

View File

@ -1,6 +1,10 @@
type: edu
type: output
files:
- name: src/Task.kt
visible: true
- name: test/Tests.kt
placeholders:
- offset: 42
length: 80
placeholder_text: TODO()
- name: test/output.txt
visible: false

View File

@ -1,6 +1,5 @@
## Summary 1 (#1)
{{ :UNTESTABLE No specific output is expected }}
Demonstrate that semicolons are optional by adding a second `println()`
statement. Put a semicolon on one `println()` and no semicolon on the other.
Define `var x = 1`. Now define `val y = x` and `val z = y`. After that, assign
2 to `x` and display the values of all three variables on different lines:
first `x`, then `y`, then `z`.

View File

@ -1,9 +0,0 @@
package summaryIExercise1
import org.junit.Test
import util.untestable
class TestSummaryIExercise1 {
@Test
fun test() = untestable()
}

View File

@ -1,17 +1,26 @@
package summaryIExercise10
fun countDigits(number: Int, digit: Int): Int {
var worker = number
var occurrences = 0
while (worker > 0) {
if (worker % 10 == digit) {
occurrences++
fun showSnake(rows: Int, columns: Int) {
val width = (rows * columns).toString().length + 1
for (i in 0 until rows) {
for (j in 0 until columns) {
val value = if (i % 2 == 0) {
i * columns + j
} else {
i * columns + (columns - 1 - j)
}
print("%${width}d".format(value))
}
worker /= 10
println()
}
return occurrences
}
fun main() {
println(countDigits(764241, 4)) // 2
}
showSnake(4, 5)
}
/* Output:
0 1 2 3 4
9 8 7 6 5
10 11 12 13 14
19 18 17 16 15
*/

View File

@ -3,10 +3,10 @@ files:
- name: src/Task.kt
visible: true
placeholders:
- offset: 147
length: 70
- offset: 71
length: 298
placeholder_text: TODO()
- name: test/Tests.kt
visible: false
feedback_link: |
https://docs.google.com/forms/d/e/1FAIpQLSdkaliSwYkjiV21bZl0yP-In2g5p17sAQCfaGjyHx_QYMWTiQ/viewform?usp=pp_url&entry.189755027=Programming+Basics+%2F+Summary+1+%2F+Exercise1
https://docs.google.com/forms/d/e/1FAIpQLSdkaliSwYkjiV21bZl0yP-In2g5p17sAQCfaGjyHx_QYMWTiQ/viewform?usp=pp_url&entry.189755027=Programming+Basics+%2F+Summary+1+%2F+Exercise4

View File

@ -1,2 +1,2 @@
id: 399594
update_date: Wed, 03 Oct 2018 12:37:30 UTC
id: 399599
update_date: Wed, 03 Oct 2018 12:37:32 UTC

View File

@ -1,24 +1,14 @@
## Summary 1 (#10)
Write a function that uses a `while` loop to count the occurrences of a given
digit within a decimal number. Place the decimal number in a variable called
`worker`. Each pass through the loop tests the right-most digit of `worker`,
then at the end of the loop, removes that right-most digit from `worker`. The
`occurrences` variable contains the number of occurrences of the digit you
seek.
Create a function `showSnake(rows: Int, columns: Int)` that displays a table
filled with sequential numbers in a form of snake. For example, `showSnake(3,
3)` should produce the following:
This table shows the values during each loop while finding occurrences of `1`
in `121341`:
```
0 1 2
5 4 3
6 7 8
```
| `worker` | Removed | `occurrences` |
|----------|---------|---------------|
| 121341 | - | 0 |
| 12134 | 1 | 1 |
| 1213 | 41 | 1 |
| 121 | 341 | 1 |
| 12 | 1341 | 2 |
| 1 | 21341 | 2 |
| - | 121341 | 3 |
The "Removed" values are in the table for clarity, but you don't need a
"Removed" variable in your solution.
For proper alignment use `"%3d".format(number)` to place any necessary spaces
before the number.

View File

@ -1,33 +1,61 @@
package summaryIExercise10
import org.junit.Assert
import org.junit.FixMethodOrder
import org.junit.Test
import org.junit.runners.MethodSorters
import util.TIMEOUT
import util.runAndCheckSystemOutput
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
class TestSummaryIExercise10 {
private fun checkCountDigits(number: Int, digit: Int, expected: Int) {
Assert.assertEquals("Wrong number of `$digit` digits in the `$number` number",
expected, countDigits(number, digit))
private fun checkOutput(rows: Int, columns: Int, expected: String) {
runAndCheckSystemOutput(
"Incorrect output for rows = $rows, columns = $columns:",
expected) {
showSnake(rows, columns)
}
}
@Test(timeout = TIMEOUT)
fun testCount1() = checkCountDigits(121341, 1, 3)
fun testSnake2() = checkOutput(2, 2,
"""
| 0 1
| 3 2
|
""".trimMargin())
@Test(timeout = TIMEOUT)
fun testCount2() = checkCountDigits(111111, 1, 6)
fun testSnake3() = checkOutput(3, 3,
"""
| 0 1 2
| 5 4 3
| 6 7 8
|
""".trimMargin())
@Test(timeout = TIMEOUT)
fun testCount3() = checkCountDigits(123456789, 1, 1)
fun testSnake4() = checkOutput(4, 5,
"""
| 0 1 2 3 4
| 9 8 7 6 5
| 10 11 12 13 14
| 19 18 17 16 15
|
""".trimMargin())
@Test(timeout = TIMEOUT)
fun testCount4() = checkCountDigits(123456789, 0, 0)
@Test(timeout = TIMEOUT)
fun testCount5() = checkCountDigits(111222111, 2, 3)
@Test(timeout = TIMEOUT)
fun testCount6() = checkCountDigits(0, 5, 0)
fun testSnake5() = checkOutput(10, 11,
"""
| 0 1 2 3 4 5 6 7 8 9 10
| 21 20 19 18 17 16 15 14 13 12 11
| 22 23 24 25 26 27 28 29 30 31 32
| 43 42 41 40 39 38 37 36 35 34 33
| 44 45 46 47 48 49 50 51 52 53 54
| 65 64 63 62 61 60 59 58 57 56 55
| 66 67 68 69 70 71 72 73 74 75 76
| 87 86 85 84 83 82 81 80 79 78 77
| 88 89 90 91 92 93 94 95 96 97 98
| 109 108 107 106 105 104 103 102 101 100 99
|
""".trimMargin())
}

View File

@ -1,19 +0,0 @@
package summaryIExercise11
fun reverseDecimal(number: Int): Int {
var worker = number
var result = 0
while (worker > 0) {
result += worker % 10
worker /= 10
if (worker != 0) {
result *= 10
}
}
return result
}
fun main() {
println(reverseDecimal(1234)) // 4321
}

View File

@ -1,12 +0,0 @@
type: edu
files:
- name: src/Task.kt
visible: true
placeholders:
- offset: 69
length: 171
placeholder_text: TODO()
- name: test/Tests.kt
visible: false
feedback_link: |
https://docs.google.com/forms/d/e/1FAIpQLSdkaliSwYkjiV21bZl0yP-In2g5p17sAQCfaGjyHx_QYMWTiQ/viewform?usp=pp_url&entry.189755027=Programming+Basics+%2F+Summary+1+%2F+Exercise2

View File

@ -1,12 +0,0 @@
## Summary 1 (#11)
Reverse the digits in a decimal number using a while loop. An auxiliary
`worker` variable will help you iteratively produce the `result`:
| Worker | Result |
|------------|--------|
| 1234 | 0 |
| 123 | 4 |
| 12 | 43 |
| 1 | 432 |
| 0 | 4321 |

View File

@ -1,30 +0,0 @@
package summaryIExercise11
import org.junit.Assert
import org.junit.FixMethodOrder
import org.junit.Test
import org.junit.runners.MethodSorters
import util.TIMEOUT
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
class TestSummaryIExercise11 {
private fun checkReverse(number: Int, expected: Int) {
Assert.assertEquals("Wrong reversed $number number",
expected, reverseDecimal(number))
}
@Test(timeout = TIMEOUT)
fun testReverse1() = checkReverse(1234, 4321)
@Test(timeout = TIMEOUT)
fun testReverse2() = checkReverse(10, 1)
@Test(timeout = TIMEOUT)
fun testReverse3() = checkReverse(123456789, 987654321)
@Test(timeout = TIMEOUT)
fun testReverse4() = checkReverse(111, 111)
@Test(timeout = TIMEOUT)
fun testReverse5() = checkReverse(0, 0)
}

View File

@ -1,23 +0,0 @@
package summaryIExercise12
fun printTriangle(n: Int) {
for (i in 1..n) {
repeat(n - i) {
print(' ')
}
repeat(2 * i - 1) {
print('#')
}
println()
}
}
fun main() {
printTriangle(4)
}
/* Output:
#
###
#####
#######
*/

View File

@ -1,12 +0,0 @@
type: edu
files:
- name: src/Task.kt
visible: true
placeholders:
- offset: 58
length: 125
placeholder_text: TODO()
- name: test/Tests.kt
visible: false
feedback_link: |
https://docs.google.com/forms/d/e/1FAIpQLSdkaliSwYkjiV21bZl0yP-In2g5p17sAQCfaGjyHx_QYMWTiQ/viewform?usp=pp_url&entry.189755027=Programming+Basics+%2F+Summary+1+%2F+Exercise3

View File

@ -1,13 +0,0 @@
## Summary 1 (#12)
Display a triangle. For n = 6 the function `showTriangle()` should produce the
following:
```
#
###
#####
#######
#########
###########
```

View File

@ -1,60 +0,0 @@
package summaryIExercise12
import org.junit.FixMethodOrder
import org.junit.Test
import org.junit.runners.MethodSorters
import util.TIMEOUT
import util.runAndCheckSystemOutput
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
class TestSummaryIExercise12 {
private fun checkOutput(n: Int, expected: String) {
runAndCheckSystemOutput(
"Incorrect output for n = $n:",
expected) {
printTriangle(n)
}
}
@Test(timeout = TIMEOUT)
fun testPyramid1() = checkOutput(1, "#\n")
@Test(timeout = TIMEOUT)
fun testPyramid2() = checkOutput(2,
"""
| #
|###
|
""".trimMargin())
@Test(timeout = TIMEOUT)
fun testPyramid3() = checkOutput(3,
"""
| #
| ###
|#####
|
""".trimMargin())
@Test(timeout = TIMEOUT)
fun testPyramid4() = checkOutput(4,
"""
| #
| ###
| #####
|#######
|
""".trimMargin())
@Test(timeout = TIMEOUT)
fun testPyramid6() = checkOutput(6,
"""
| #
| ###
| #####
| #######
| #########
|###########
|
""".trimMargin())
}

View File

@ -1,26 +0,0 @@
package summaryIExercise13
fun showSnake(rows: Int, columns: Int) {
val width = (rows * columns).toString().length + 1
for (i in 0 until rows) {
for (j in 0 until columns) {
val value = if (i % 2 == 0) {
i * columns + j
} else {
i * columns + (columns - 1 - j)
}
print("%${width}d".format(value))
}
println()
}
}
fun main() {
showSnake(4, 5)
}
/* Output:
0 1 2 3 4
9 8 7 6 5
10 11 12 13 14
19 18 17 16 15
*/

View File

@ -1,12 +0,0 @@
type: edu
files:
- name: src/Task.kt
visible: true
placeholders:
- offset: 71
length: 298
placeholder_text: TODO()
- name: test/Tests.kt
visible: false
feedback_link: |
https://docs.google.com/forms/d/e/1FAIpQLSdkaliSwYkjiV21bZl0yP-In2g5p17sAQCfaGjyHx_QYMWTiQ/viewform?usp=pp_url&entry.189755027=Programming+Basics+%2F+Summary+1+%2F+Exercise4

View File

@ -1,2 +0,0 @@
id: 399599
update_date: Wed, 03 Oct 2018 12:37:32 UTC

View File

@ -1,14 +0,0 @@
## Summary 1 (#13)
Create a function `showSnake(rows: Int, columns: Int)` that displays a table
filled with sequential numbers in a form of snake. For example, `showSnake(3,
3)` should produce the following:
```
0 1 2
5 4 3
6 7 8
```
For proper alignment use `"%3d".format(number)` to place any necessary spaces
before the number.

View File

@ -1,61 +0,0 @@
package summaryIExercise13
import org.junit.FixMethodOrder
import org.junit.Test
import org.junit.runners.MethodSorters
import util.TIMEOUT
import util.runAndCheckSystemOutput
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
class TestSummaryIExercise13 {
private fun checkOutput(rows: Int, columns: Int, expected: String) {
runAndCheckSystemOutput(
"Incorrect output for rows = $rows, columns = $columns:",
expected) {
showSnake(rows, columns)
}
}
@Test(timeout = TIMEOUT)
fun testSnake2() = checkOutput(2, 2,
"""
| 0 1
| 3 2
|
""".trimMargin())
@Test(timeout = TIMEOUT)
fun testSnake3() = checkOutput(3, 3,
"""
| 0 1 2
| 5 4 3
| 6 7 8
|
""".trimMargin())
@Test(timeout = TIMEOUT)
fun testSnake4() = checkOutput(4, 5,
"""
| 0 1 2 3 4
| 9 8 7 6 5
| 10 11 12 13 14
| 19 18 17 16 15
|
""".trimMargin())
@Test(timeout = TIMEOUT)
fun testSnake5() = checkOutput(10, 11,
"""
| 0 1 2 3 4 5 6 7 8 9 10
| 21 20 19 18 17 16 15 14 13 12 11
| 22 23 24 25 26 27 28 29 30 31 32
| 43 42 41 40 39 38 37 36 35 34 33
| 44 45 46 47 48 49 50 51 52 53 54
| 65 64 63 62 61 60 59 58 57 56 55
| 66 67 68 69 70 71 72 73 74 75 76
| 87 86 85 84 83 82 81 80 79 78 77
| 88 89 90 91 92 93 94 95 96 97 98
| 109 108 107 106 105 104 103 102 101 100 99
|
""".trimMargin())
}

View File

@ -1,11 +1,20 @@
package summaryIExercise2
fun other(s: String): String {
var index = 0
var result = ""
for (c in s) {
if (index % 2 == 0) {
result += c
}
index++
}
return result
}
fun main() {
var x = 1
val y = x
val z = y
x = 2
println(x)
println(y)
println(z)
}
println(other("cement"))
}
/* Output:
cmn
*/

View File

@ -1,10 +1,10 @@
type: output
type: edu
files:
- name: src/Task.kt
visible: true
placeholders:
- offset: 42
length: 80
- offset: 60
length: 130
placeholder_text: TODO()
- name: test/output.txt
- name: test/Tests.kt
visible: false

View File

@ -1,5 +1,5 @@
## Summary 1 (#2)
Define `var x = 1`. Now define `val y = x` and `val z = y`. After that, assign
2 to `x` and display the values of all three variables on different lines:
first `x`, then `y`, then `z`.
Create a function `other()` that takes a `String` parameter and returns a
`String` containing every other letter of the parameter. For example, for
input "cement" it should return "cmn".

View File

@ -0,0 +1,23 @@
package summaryIExercise2
import org.junit.Assert
import org.junit.Test
class TestSummaryIExercise2 {
private fun testString(s: String) {
Assert.assertEquals("Wrong result for '$s'",
s.filterIndexed { index, _ -> index % 2 == 0 }, other(s))
}
@Test
fun test1() = testString("cement")
@Test
fun test2() = testString("abcdef")
@Test
fun test3() = testString("1234567890")
@Test
fun test4() = testString(('A'..'Z').joinToString(""))
}

View File

@ -1,20 +1,15 @@
package summaryIExercise3
fun other(s: String): String {
var index = 0
var result = ""
for (c in s) {
if (index % 2 == 0) {
result += c
}
index++
}
return result
}
fun first(a: Boolean, b: Boolean, c: Boolean): Boolean =
if (a) b && c else false
fun second(a: Boolean, b: Boolean, c: Boolean): Boolean =
if (a) true else b || c
fun main() {
println(other("cement"))
}
/* Output:
cmn
*/
println(first(true, true, true))
println(first(true, false, true))
println(second(false, false, false))
println(second(false, true, false))
}

View File

@ -3,8 +3,17 @@ files:
- name: src/Task.kt
visible: true
placeholders:
- offset: 60
length: 130
- offset: 93
length: 6
placeholder_text: TODO()
- offset: 105
length: 5
placeholder_text: TODO()
- offset: 179
length: 4
placeholder_text: TODO()
- offset: 189
length: 6
placeholder_text: TODO()
- name: test/Tests.kt
visible: false

View File

@ -1,5 +1,12 @@
## Summary 1 (#3)
Create a function `other()` that takes a `String` parameter and returns a
`String` containing every other letter of the parameter. For example, for
input "cement" it should return "cmn".
Write a function `first()` that has an *expression body* starting with `if`.
`first()` takes three `Boolean` parameters and "ands" them together to produce
the result. Write `second()` to do the same but "or" all three parameters. In
`main()`, display the result of combining `first()` and `second()` using both
"and" and "or":
| `first()` Arguments | `second()` Arguments |
|---------------------|----------------------|
| true, true, true | false, false, false |
| true, false, true | false, true, false |

View File

@ -4,20 +4,37 @@ import org.junit.Assert
import org.junit.Test
class TestSummaryIExercise3 {
private fun testString(s: String) {
Assert.assertEquals("Wrong result for '$s'",
s.filterIndexed { index, _ -> index % 2 == 0 }, other(s))
}
private fun testFirst(a: Boolean, b: Boolean, c: Boolean) {
Assert.assertEquals("Wrong result for 'first($a, $b, $c)'",
first(a, b, c), a && b && c)
}
@Test
fun test1() = testString("cement")
private fun testSecond(a: Boolean, b: Boolean, c: Boolean) {
Assert.assertEquals("Wrong result for 'second($a, $b, $c)'",
second(a, b, c), a || b || c)
}
@Test
fun test2() = testString("abcdef")
@Test
fun test1() {
testFirst(true, true, true)
testFirst(true, true, false)
testFirst(true, false, true)
testFirst(false, true, true)
testFirst(false, false, true)
testFirst(false, true, false)
testFirst(true, false, false)
testFirst(false, false, false)
}
@Test
fun test3() = testString("1234567890")
@Test
fun test4() = testString(('A'..'Z').joinToString(""))
@Test
fun test2() {
testSecond(true, true, true)
testSecond(true, true, false)
testSecond(true, false, true)
testSecond(false, true, true)
testSecond(false, false, true)
testSecond(false, true, false)
testSecond(true, false, false)
testSecond(false, false, false)
}
}

View File

@ -1,15 +1,19 @@
package summaryIExercise4
fun first(a: Boolean, b: Boolean, c: Boolean): Boolean =
if (a) b && c else false
fun testLong() {
println(Long.MAX_VALUE + 1)
}
fun second(a: Boolean, b: Boolean, c: Boolean): Boolean =
if (a) true else b || c
fun testDouble() {
println(Double.MAX_VALUE + 1)
}
fun testDouble2() {
println(Double.MAX_VALUE + 1 == Double.MAX_VALUE)
}
fun main() {
println(first(true, true, true))
println(first(true, false, true))
println(second(false, false, false))
println(second(false, true, false))
testLong()
testDouble()
testDouble2()
}

View File

@ -3,17 +3,14 @@ files:
- name: src/Task.kt
visible: true
placeholders:
- offset: 93
length: 6
- offset: 46
length: 27
placeholder_text: TODO()
- offset: 105
length: 5
- offset: 98
length: 29
placeholder_text: TODO()
- offset: 179
length: 4
placeholder_text: TODO()
- offset: 189
length: 6
- offset: 153
length: 49
placeholder_text: TODO()
- name: test/Tests.kt
visible: false

View File

@ -1,12 +1,7 @@
## Summary 1 (#4)
Write a function `first()` that has an *expression body* starting with `if`.
`first()` takes three `Boolean` parameters and "ands" them together to produce
the result. Write `second()` to do the same but "or" all three parameters. In
`main()`, display the result of combining `first()` and `second()` using both
"and" and "or":
| `first()` Arguments | `second()` Arguments |
|---------------------|----------------------|
| true, true, true | false, false, false |
| true, false, true | false, true, false |
In this exercise, we'll modify `Overflow.kt` so it tests `Long` and `Double`
in the same way. The `testLong()` function should print the `Long` maximum value
increased by `1`. The `testDouble()` function should print the `Double` maximum value
increased by `1`. `testDouble2()` should print the result of comparison
of `Double.MAX_VALUE` and `Double.MAX_VALUE + 1`.

View File

@ -1,40 +1,32 @@
package summaryIExercise4
import org.junit.Assert
import org.junit.Test
import util.runAndCheckSystemOutput
class TestSummaryIExercise4 {
private fun testFirst(a: Boolean, b: Boolean, c: Boolean) {
Assert.assertEquals("Wrong result for 'first($a, $b, $c)'",
first(a, b, c), a && b && c)
}
private fun testSecond(a: Boolean, b: Boolean, c: Boolean) {
Assert.assertEquals("Wrong result for 'second($a, $b, $c)'",
second(a, b, c), a || b || c)
@Test
fun test1Long() {
runAndCheckSystemOutput(
"Wrong output for 'testLong()'",
"-9223372036854775808") {
testLong()
}
}
@Test
fun test1() {
testFirst(true, true, true)
testFirst(true, true, false)
testFirst(true, false, true)
testFirst(false, true, true)
testFirst(false, false, true)
testFirst(false, true, false)
testFirst(true, false, false)
testFirst(false, false, false)
fun test2Double() {
runAndCheckSystemOutput(
"Wrong output for 'testDouble()'",
"1.7976931348623157E308") {
testDouble()
}
}
@Test
fun test2() {
testSecond(true, true, true)
testSecond(true, true, false)
testSecond(true, false, true)
testSecond(false, true, true)
testSecond(false, false, true)
testSecond(false, true, false)
testSecond(true, false, false)
testSecond(false, false, false)
fun test3Double2() {
runAndCheckSystemOutput(
"Wrong output for 'testDouble2()'",
"true") {
testDouble2()
}
}
}

View File

@ -1 +1,19 @@
package summaryIExercise5
package summaryIExercise5
fun everyFifth(start: Int, end: Int) {
for (i in start..end) {
if ((i - start) % 5 == 4) {
println(i)
}
}
}
fun main() {
everyFifth(11, 30)
}
/* Output:
15
20
25
30
*/

View File

@ -2,5 +2,9 @@ type: edu
files:
- name: src/Task.kt
visible: true
placeholders:
- offset: 68
length: 82
placeholder_text: TODO()
- name: test/Tests.kt
visible: false

View File

@ -1,10 +1,5 @@
## Summary 1 (#5)
{{ :UNTESTABLE I don't really understand what is expected here. What's more,
since the previous function now has initial 'if' code, I don't see the necessity
in this one. }}
Modify `first()` and `second()` from the previous exercise so they produce
`String` results using a `String` template, substituting the values of the
parameters and showing the result by calculating an expression within the
template. Test them using the same arguments from the table above.
Implement the function `everyFifth` which should display every fifth number
in the given range. For instance, `everyFifth(11, 30)` should display the
numbers `15`, `20`, `25`, and `30`.

View File

@ -1,9 +1,37 @@
package summaryIExercise5
import org.junit.Test
import util.untestable
import util.runAndCheckSystemOutput
class TestSummaryIExercise5 {
@Test
fun test() = untestable()
private fun testOutput(start: Int, end: Int) {
val expected = (start..end)
.filterIndexed { index, _ -> index % 5 == 4 }
.joinToString("\n")
runAndCheckSystemOutput("Wrong output for 'everyFifth($start, $end)'", expected) {
everyFifth(start, end)
}
}
@Test
fun test1() = testOutput(11, 30)
@Test
fun test2() = testOutput(1, 5)
@Test
fun test3() = testOutput(3, 14)
@Test
fun test4() = testOutput(-20, 20)
@Test
fun test5() = testOutput(1, 4)
@Test
fun test6() = testOutput(0, 44)
@Test
fun test7() = testOutput(100, 150)
}

View File

@ -1,19 +1,19 @@
package summaryIExercise6
fun testLong() {
println(Long.MAX_VALUE + 1)
}
fun testDouble() {
println(Double.MAX_VALUE + 1)
}
fun testDouble2() {
println(Double.MAX_VALUE + 1 == Double.MAX_VALUE)
fun everyFifthNonWhitespace(s: String) {
var i = 1
for (c in s) {
if (i % 5 == 0 && c != ' ') {
println(c)
}
if (c != ' ') i++
}
}
fun main() {
testLong()
testDouble()
testDouble2()
}
everyFifthNonWhitespace("abc d e fgh ik")
}
/* Output:
e
k
*/

View File

@ -3,14 +3,8 @@ files:
- name: src/Task.kt
visible: true
placeholders:
- offset: 46
length: 27
placeholder_text: TODO()
- offset: 98
length: 29
placeholder_text: TODO()
- offset: 153
length: 49
- offset: 70
length: 109
placeholder_text: TODO()
- name: test/Tests.kt
visible: false

View File

@ -1,7 +1,6 @@
## Summary 1 (#6)
In this exercise, we'll modify `Overflow.kt` so it tests `Long` and `Double`
in the same way. The `testLong()` function should print the `Long` maximum value
increased by `1`. The `testDouble()` function should print the `Double` maximum value
increased by `1`. `testDouble2()` should print the result of comparison
of `Double.MAX_VALUE` and `Double.MAX_VALUE + 1`.
Implement the function `everyFifthText` which should display every fifth
non-whitespace character in the given text. For instance,
`everyFifthNonWhitespace("abc d e fgh ik")` displays the characters `e`
(fifth character if not counting whitespaces) and `k` (tenth).

View File

@ -4,29 +4,26 @@ import org.junit.Test
import util.runAndCheckSystemOutput
class TestSummaryIExercise6 {
@Test
fun test1Long() {
runAndCheckSystemOutput(
"Wrong output for 'testLong()'",
"-9223372036854775808") {
testLong()
private fun testInput(s: String) {
val expected = s.toList()
.filter { it != ' ' }
.filterIndexed { index, _ -> index % 5 == 4 }
.joinToString("\n")
runAndCheckSystemOutput("Wrong result for 'everyFifthNonWhitespace()'",
expected) {
everyFifthNonWhitespace(s)
}
}
@Test
fun test2Double() {
runAndCheckSystemOutput(
"Wrong output for 'testDouble()'",
"1.7976931348623157E308") {
testDouble()
}
}
fun test1() = testInput("abc d e fgh ik")
@Test
fun test3Double2() {
runAndCheckSystemOutput(
"Wrong output for 'testDouble2()'",
"true") {
testDouble2()
}
}
fun test2() = testInput("12 3 4 5 6 789 0")
@Test
fun test3() = testInput("* *")
@Test
fun test4() = testInput("1 2 345")
}

View File

@ -1,15 +1,17 @@
package summaryIExercise7
fun testCondition(i: Int) = i < 100
fun countDigits(number: Int, digit: Int): Int {
var worker = number
var occurrences = 0
while (worker > 0) {
if (worker % 10 == digit) {
occurrences++
}
worker /= 10
}
return occurrences
}
fun main() {
var i = 0
while (i++ < 100) {
if (i % 10 == 0) {
print(".")
}
}
}
/* Output:
..........
*/
println(countDigits(764241, 4)) // 2
}

View File

@ -3,12 +3,10 @@ files:
- name: src/Task.kt
visible: true
placeholders:
- offset: 91
length: 69
placeholder_text: |-
while (testCondition(i)) {
print(".")
i += 10
}
- offset: 146
length: 70
placeholder_text: TODO()
- name: test/Tests.kt
visible: false
feedback_link: |
https://docs.google.com/forms/d/e/1FAIpQLSdkaliSwYkjiV21bZl0yP-In2g5p17sAQCfaGjyHx_QYMWTiQ/viewform?usp=pp_url&entry.189755027=Programming+Basics+%2F+Summary+1+%2F+Exercise1

View File

@ -0,0 +1,2 @@
id: 399594
update_date: Wed, 03 Oct 2018 12:37:30 UTC

View File

@ -1,10 +1,24 @@
## Summary 1 (#7)
{{ :UNTESTABLE (to some extent)
Don't really understand what solution is expected. Also, the current test
passes even without any changes: I can only test the produced output (which
doesn't change) }}
Write a function that uses a `while` loop to count the occurrences of a given
digit within a decimal number. Place the decimal number in a variable called
`worker`. Each pass through the loop tests the right-most digit of `worker`,
then at the end of the loop, removes that right-most digit from `worker`. The
`occurrences` variable contains the number of occurrences of the digit you
seek.
Modify `While.kt` to replace the call to `testCondition()` with an inline `++`
increment (remove the increment in the `while` body) and a `Boolean` test,
producing the same output.
This table shows the values during each loop while finding occurrences of `1`
in `121341`:
| `worker` | Removed | `occurrences` |
|----------|---------|---------------|
| 121341 | - | 0 |
| 12134 | 1 | 1 |
| 1213 | 41 | 1 |
| 121 | 341 | 1 |
| 12 | 1341 | 2 |
| 1 | 21341 | 2 |
| - | 121341 | 3 |
The "Removed" values are in the table for clarity, but you don't need a
"Removed" variable in your solution.

View File

@ -1,16 +1,33 @@
package summaryIExercise7
import org.junit.Assert
import org.junit.FixMethodOrder
import org.junit.Test
import util.runAndCheckSystemOutput
import org.junit.runners.MethodSorters
import util.TIMEOUT
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
class TestSummaryIExercise7 {
@Test
fun test() {
runAndCheckSystemOutput(
"Wrong output",
".........."
) {
main()
}
private fun checkCountDigits(number: Int, digit: Int, expected: Int) {
Assert.assertEquals("Wrong number of `$digit` digits in the `$number` number",
expected, countDigits(number, digit))
}
@Test(timeout = TIMEOUT)
fun testCount1() = checkCountDigits(121341, 1, 3)
@Test(timeout = TIMEOUT)
fun testCount2() = checkCountDigits(111111, 1, 6)
@Test(timeout = TIMEOUT)
fun testCount3() = checkCountDigits(123456789, 1, 1)
@Test(timeout = TIMEOUT)
fun testCount4() = checkCountDigits(123456789, 0, 0)
@Test(timeout = TIMEOUT)
fun testCount5() = checkCountDigits(111222111, 2, 3)
@Test(timeout = TIMEOUT)
fun testCount6() = checkCountDigits(0, 5, 0)
}

View File

@ -1,19 +1,19 @@
package summaryIExercise8
fun everyFifth(start: Int, end: Int) {
for (i in start..end) {
if ((i - start) % 5 == 4) {
println(i)
fun reverseDecimal(number: Int): Int {
var worker = number
var result = 0
while (worker > 0) {
result += worker % 10
worker /= 10
if (worker != 0) {
result *= 10
}
}
return result
}
fun main() {
everyFifth(11, 30)
}
/* Output:
15
20
25
30
*/
println(reverseDecimal(1234)) // 4321
}

View File

@ -4,7 +4,9 @@ files:
visible: true
placeholders:
- offset: 68
length: 82
length: 171
placeholder_text: TODO()
- name: test/Tests.kt
visible: false
feedback_link: |
https://docs.google.com/forms/d/e/1FAIpQLSdkaliSwYkjiV21bZl0yP-In2g5p17sAQCfaGjyHx_QYMWTiQ/viewform?usp=pp_url&entry.189755027=Programming+Basics+%2F+Summary+1+%2F+Exercise2

View File

@ -1,5 +1,12 @@
## Summary 1 (#8)
Implement the function `everyFifth` which should display every fifth number
in the given range. For instance, `everyFifth(11, 30)` should display the
numbers `15`, `20`, `25`, and `30`.
Reverse the digits in a decimal number using a while loop. An auxiliary
`worker` variable will help you iteratively produce the `result`:
| Worker | Result |
|------------|--------|
| 1234 | 0 |
| 123 | 4 |
| 12 | 43 |
| 1 | 432 |
| 0 | 4321 |

View File

@ -1,37 +1,30 @@
package summaryIExercise8
import org.junit.Assert
import org.junit.FixMethodOrder
import org.junit.Test
import util.runAndCheckSystemOutput
import org.junit.runners.MethodSorters
import util.TIMEOUT
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
class TestSummaryIExercise8 {
private fun testOutput(start: Int, end: Int) {
val expected = (start..end)
.filterIndexed { index, _ -> index % 5 == 4 }
.joinToString("\n")
private fun checkReverse(number: Int, expected: Int) {
Assert.assertEquals("Wrong reversed $number number",
expected, reverseDecimal(number))
}
runAndCheckSystemOutput("Wrong output for 'everyFifth($start, $end)'", expected) {
everyFifth(start, end)
}
}
@Test(timeout = TIMEOUT)
fun testReverse1() = checkReverse(1234, 4321)
@Test
fun test1() = testOutput(11, 30)
@Test(timeout = TIMEOUT)
fun testReverse2() = checkReverse(10, 1)
@Test
fun test2() = testOutput(1, 5)
@Test(timeout = TIMEOUT)
fun testReverse3() = checkReverse(123456789, 987654321)
@Test
fun test3() = testOutput(3, 14)
@Test(timeout = TIMEOUT)
fun testReverse4() = checkReverse(111, 111)
@Test
fun test4() = testOutput(-20, 20)
@Test
fun test5() = testOutput(1, 4)
@Test
fun test6() = testOutput(0, 44)
@Test
fun test7() = testOutput(100, 150)
@Test(timeout = TIMEOUT)
fun testReverse5() = checkReverse(0, 0)
}

View File

@ -1,19 +1,23 @@
package summaryIExercise9
fun everyFifthNonWhitespace(s: String) {
var i = 1
for (c in s) {
if (i % 5 == 0 && c != ' ') {
println(c)
fun printTriangle(n: Int) {
for (i in 1..n) {
repeat(n - i) {
print(' ')
}
if (c != ' ') i++
repeat(2 * i - 1) {
print('#')
}
println()
}
}
fun main() {
everyFifthNonWhitespace("abc d e fgh ik")
printTriangle(4)
}
/* Output:
e
k
#
###
#####
#######
*/

View File

@ -3,8 +3,10 @@ files:
- name: src/Task.kt
visible: true
placeholders:
- offset: 70
length: 109
- offset: 57
length: 125
placeholder_text: TODO()
- name: test/Tests.kt
visible: false
feedback_link: |
https://docs.google.com/forms/d/e/1FAIpQLSdkaliSwYkjiV21bZl0yP-In2g5p17sAQCfaGjyHx_QYMWTiQ/viewform?usp=pp_url&entry.189755027=Programming+Basics+%2F+Summary+1+%2F+Exercise3

View File

@ -1,6 +1,13 @@
## Summary 1 (#9)
Implement the function `everyFifthText` which should display every fifth
non-whitespace character in the given text. For instance,
`everyFifthNonWhitespace("abc d e fgh ik")` displays the characters `e`
(fifth character if not counting whitespaces) and `k` (tenth).
Display a triangle. For n = 6 the function `showTriangle()` should produce the
following:
```
#
###
#####
#######
#########
###########
```

View File

@ -1,29 +1,60 @@
package summaryIExercise9
import org.junit.FixMethodOrder
import org.junit.Test
import org.junit.runners.MethodSorters
import util.TIMEOUT
import util.runAndCheckSystemOutput
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
class TestSummaryIExercise9 {
private fun testInput(s: String) {
val expected = s.toList()
.filter { it != ' ' }
.filterIndexed { index, _ -> index % 5 == 4 }
.joinToString("\n")
runAndCheckSystemOutput("Wrong result for 'everyFifthNonWhitespace()'",
private fun checkOutput(n: Int, expected: String) {
runAndCheckSystemOutput(
"Incorrect output for n = $n:",
expected) {
everyFifthNonWhitespace(s)
printTriangle(n)
}
}
@Test
fun test1() = testInput("abc d e fgh ik")
@Test(timeout = TIMEOUT)
fun testPyramid1() = checkOutput(1, "#\n")
@Test
fun test2() = testInput("12 3 4 5 6 789 0")
@Test(timeout = TIMEOUT)
fun testPyramid2() = checkOutput(2,
"""
| #
|###
|
""".trimMargin())
@Test
fun test3() = testInput("* *")
@Test(timeout = TIMEOUT)
fun testPyramid3() = checkOutput(3,
"""
| #
| ###
|#####
|
""".trimMargin())
@Test
fun test4() = testInput("1 2 345")
@Test(timeout = TIMEOUT)
fun testPyramid4() = checkOutput(4,
"""
| #
| ###
| #####
|#######
|
""".trimMargin())
@Test(timeout = TIMEOUT)
fun testPyramid6() = checkOutput(6,
"""
| #
| ###
| #####
| #######
| #########
|###########
|
""".trimMargin())
}

View File

@ -10,6 +10,3 @@ content:
- Exercise 8
- Exercise 9
- Exercise 10
- Exercise 11
- Exercise 12
- Exercise 13

View File

@ -2553,171 +2553,166 @@ public class TestAllExamples extends AbstractTestExamples {
@Test
public void testTask44() {
testExample("../AtomicKotlinCourse/Programming Basics/Summary 1/Exercise 2/src/Task.kt", summaryIExercise2.TaskKt::main);
testExample("../AtomicKotlinCourse/Programming Basics/Summary 1/Exercise 1/src/Task.kt", summaryIExercise1.TaskKt::main);
}
@Test
public void testTask45() {
testExample("../AtomicKotlinCourse/Programming Basics/Summary 1/Exercise 3/src/Task.kt", summaryIExercise3.TaskKt::main);
testExample("../AtomicKotlinCourse/Programming Basics/Summary 1/Exercise 2/src/Task.kt", summaryIExercise2.TaskKt::main);
}
@Test
public void testTask46() {
testExample("../AtomicKotlinCourse/Programming Basics/Summary 1/Exercise 4/src/Task.kt", summaryIExercise4.TaskKt::main);
testExample("../AtomicKotlinCourse/Programming Basics/Summary 1/Exercise 3/src/Task.kt", summaryIExercise3.TaskKt::main);
}
@Test
public void testTask47() {
testExample("../AtomicKotlinCourse/Programming Basics/Summary 1/Exercise 6/src/Task.kt", summaryIExercise6.TaskKt::main);
testExample("../AtomicKotlinCourse/Programming Basics/Summary 1/Exercise 4/src/Task.kt", summaryIExercise4.TaskKt::main);
}
@Test
public void testTask48() {
testExample("../AtomicKotlinCourse/Programming Basics/Summary 1/Exercise 7/src/Task.kt", summaryIExercise7.TaskKt::main);
testExample("../AtomicKotlinCourse/Programming Basics/Summary 1/Exercise 5/src/Task.kt", summaryIExercise5.TaskKt::main);
}
@Test
public void testTask49() {
testExample("../AtomicKotlinCourse/Programming Basics/Summary 1/Exercise 8/src/Task.kt", summaryIExercise8.TaskKt::main);
testExample("../AtomicKotlinCourse/Programming Basics/Summary 1/Exercise 6/src/Task.kt", summaryIExercise6.TaskKt::main);
}
@Test
public void testTask50() {
testExample("../AtomicKotlinCourse/Programming Basics/Summary 1/Exercise 9/src/Task.kt", summaryIExercise9.TaskKt::main);
testExample("../AtomicKotlinCourse/Programming Basics/Summary 1/Exercise 7/src/Task.kt", summaryIExercise7.TaskKt::main);
}
@Test
public void testTask51() {
testExample("../AtomicKotlinCourse/Programming Basics/Summary 1/Exercise 10/src/Task.kt", summaryIExercise10.TaskKt::main);
testExample("../AtomicKotlinCourse/Programming Basics/Summary 1/Exercise 8/src/Task.kt", summaryIExercise8.TaskKt::main);
}
@Test
public void testTask52() {
testExample("../AtomicKotlinCourse/Programming Basics/Summary 1/Exercise 11/src/Task.kt", summaryIExercise11.TaskKt::main);
testExample("../AtomicKotlinCourse/Programming Basics/Summary 1/Exercise 9/src/Task.kt", summaryIExercise9.TaskKt::main);
}
@Test
public void testTask53() {
testExample("../AtomicKotlinCourse/Programming Basics/Summary 1/Exercise 12/src/Task.kt", summaryIExercise12.TaskKt::main);
testExample("../AtomicKotlinCourse/Programming Basics/Summary 1/Exercise 10/src/Task.kt", summaryIExercise10.TaskKt::main);
}
@Test
public void testTask54() {
testExample("../AtomicKotlinCourse/Programming Basics/Summary 1/Exercise 13/src/Task.kt", summaryIExercise13.TaskKt::main);
}
@Test
public void testTask55() {
testExample("../AtomicKotlinCourse/Introduction to Objects/Objects Everywhere/Exercise 1/src/Task.kt", objectsEverywhereExercise1.TaskKt::main);
}
@Test
public void testTask56() {
public void testTask55() {
testExample("../AtomicKotlinCourse/Introduction to Objects/Objects Everywhere/Exercise 2/src/Task.kt", objectsEverywhereExercise2.TaskKt::main);
}
@Test
public void testTask57() {
public void testTask56() {
testExample("../AtomicKotlinCourse/Introduction to Objects/Objects Everywhere/Exercise 3/src/Task.kt", objectsEverywhereExercise3.TaskKt::main);
}
@Test
public void testTask58() {
public void testTask57() {
testExample("../AtomicKotlinCourse/Introduction to Objects/Objects Everywhere/Exercise 4/src/Task.kt", objectsEverywhereExercise4.TaskKt::main);
}
@Test
public void testTask59() {
public void testTask58() {
testExample("../AtomicKotlinCourse/Introduction to Objects/Objects Everywhere/Exercise 5/src/Task.kt", objectsEverywhere5.TaskKt::main);
}
@Test
public void testTask60() {
public void testTask59() {
testExample("../AtomicKotlinCourse/Introduction to Objects/Creating Classes/Exercise 2/src/Task.kt", creatingClassesExercise2.TaskKt::main);
}
@Test
public void testTask61() {
public void testTask60() {
testExample("../AtomicKotlinCourse/Introduction to Objects/Creating Classes/Exercise 3/src/Task.kt", creatingClassesExercise3.TaskKt::main);
}
@Test
public void testTask62() {
public void testTask61() {
testExample("../AtomicKotlinCourse/Introduction to Objects/Creating Classes/Exercise 4/src/Task.kt", creatingClasses4.TaskKt::main);
}
@Test
public void testTask63() {
public void testTask62() {
testExample("../AtomicKotlinCourse/Introduction to Objects/Creating Classes/Exercise 5/src/Task.kt", creatingClasses5.TaskKt::main);
}
@Test
public void testTask64() {
public void testTask63() {
testExample("../AtomicKotlinCourse/Introduction to Objects/Properties/Exercise 1/src/Task.kt", propertiesExercise1.TaskKt::main);
}
@Test
public void testTask65() {
public void testTask64() {
testExample("../AtomicKotlinCourse/Introduction to Objects/Properties/Exercise 2/src/Task.kt", propertiesExercise2.TaskKt::main);
}
@Test
public void testTask66() {
public void testTask65() {
testExample("../AtomicKotlinCourse/Introduction to Objects/Properties/Exercise 3/src/Task.kt", propertiesExercise3.TaskKt::main);
}
@Test
public void testTask67() {
public void testTask66() {
testExample("../AtomicKotlinCourse/Introduction to Objects/Constructors/Exercise 1/src/Task.kt", constructorsExercise1.TaskKt::main);
}
@Test
public void testTask68() {
public void testTask67() {
testExample("../AtomicKotlinCourse/Introduction to Objects/Constructors/Exercise 2/src/Task.kt", constructorsExercise2.TaskKt::main);
}
@Test
public void testTask69() {
public void testTask68() {
testExample("../AtomicKotlinCourse/Introduction to Objects/Constructors/Exercise 3/src/Task.kt", constructorsExercise3.TaskKt::main);
}
@Test
public void testTask70() {
public void testTask69() {
testExample("../AtomicKotlinCourse/Introduction to Objects/Constructors/Exercise 4/src/Task.kt", constructors4.TaskKt::main);
}
@Test
public void testTask71() {
public void testTask70() {
testExample("../AtomicKotlinCourse/Introduction to Objects/Constraining Visibility/Exercise 1/src/Task.kt", constrainingVisibilityExercise1.TaskKt::main);
}
@Test
public void testTask72() {
public void testTask71() {
testExample("../AtomicKotlinCourse/Introduction to Objects/Constraining Visibility/Exercise 2/src/Task.kt", constrainingVisibilityExercise2.TaskKt::main);
}
@Test
public void testTask73() {
public void testTask72() {
testExample("../AtomicKotlinCourse/Introduction to Objects/Constraining Visibility/Exercise 3/src/Task.kt", constrainingVisibilityExercise3.TaskKt::main);
}
@Test
public void testTask74() {
public void testTask73() {
testExample("../AtomicKotlinCourse/Introduction to Objects/Constraining Visibility/Exercise 4/src/Task.kt", constrainingVisibility4.TaskKt::main);
}
@Test
public void testTask75() {
public void testTask74() {
testExample("../AtomicKotlinCourse/Introduction to Objects/Constraining Visibility/Exercise 5/src/Task.kt", constrainingVisibility5.TaskKt::main);
}
@Test
public void testTask76() {
public void testTask75() {
testExample("../AtomicKotlinCourse/Introduction to Objects/Packages/Exercise 1/src/task.kt", ccc.TaskKt::main);
}
@Test
public void testTask77() {
public void testTask76() {
testExample("../AtomicKotlinCourse/Introduction to Objects/Packages/Exercise 2/src/Task.kt", packagesExercise2.TaskKt::main);
}
@ -2727,537 +2722,537 @@ public class TestAllExamples extends AbstractTestExamples {
}
@Test
public void testTask78() {
public void testTask77() {
testExample("../AtomicKotlinCourse/Introduction to Objects/Packages/Exercise 4/src/Task.kt", importsandPackages4.TaskKt::main);
}
@Test
public void testTask79() {
public void testTask78() {
testExample("../AtomicKotlinCourse/Introduction to Objects/Testing/Exercise 1/src/Task.kt", testingExercise1.TaskKt::main);
}
@Test
public void testTask80() {
public void testTask79() {
testExample("../AtomicKotlinCourse/Introduction to Objects/Testing/Exercise 2/src/Task.kt", testingExercise2.TaskKt::main);
}
@Test
public void testTask81() {
public void testTask80() {
testExample("../AtomicKotlinCourse/Introduction to Objects/Testing/Exercise 3/src/Task.kt", testingExercise3.TaskKt::main);
}
@Test
public void testTask82() {
public void testTask81() {
testExample("../AtomicKotlinCourse/Introduction to Objects/Testing/Exercise 4/src/Task.kt", testing4.TaskKt::main);
}
@Test
public void testTask83() {
public void testTask82() {
testExample("../AtomicKotlinCourse/Introduction to Objects/Exceptions/Exercise 1/src/Task.kt", exceptionsExercise1.TaskKt::main);
}
@Test
public void testTask84() {
public void testTask83() {
testExample("../AtomicKotlinCourse/Introduction to Objects/Exceptions/Exercise 2/src/Task.kt", exceptionsExercise2.TaskKt::main);
}
@Test
public void testTask85() {
public void testTask84() {
testExample("../AtomicKotlinCourse/Introduction to Objects/Exceptions/Exercise 3/src/Task.kt", exceptionsExercise3.TaskKt::main);
}
@Test
public void testTask86() {
public void testTask85() {
testExample("../AtomicKotlinCourse/Introduction to Objects/Lists/Exercise 1/src/Task.kt", listsExercise1.TaskKt::main);
}
@Test
public void testTask87() {
public void testTask86() {
testExample("../AtomicKotlinCourse/Introduction to Objects/Lists/Exercise 2/src/Task.kt", listsExercise2.TaskKt::main);
}
@Test
public void testTask88() {
public void testTask87() {
testExample("../AtomicKotlinCourse/Introduction to Objects/Lists/Exercise 4/src/Task.kt", listsExercise4.TaskKt::main);
}
@Test
public void testTask89() {
public void testTask88() {
testExample("../AtomicKotlinCourse/Introduction to Objects/Lists/Exercise 5/src/Task.kt", lists5.TaskKt::main);
}
@Test
public void testTask90() {
public void testTask89() {
testExample("../AtomicKotlinCourse/Introduction to Objects/Variable Argument Lists/Exercise 1/src/Task.kt", variableArgumentListsExercise1.TaskKt::main);
}
@Test
public void testTask91() {
public void testTask90() {
testExample("../AtomicKotlinCourse/Introduction to Objects/Variable Argument Lists/Exercise 2/src/Task.kt", variableArgumentListsExercise2.TaskKt::main);
}
@Test
public void testTask92() {
public void testTask91() {
testExample("../AtomicKotlinCourse/Introduction to Objects/Variable Argument Lists/Exercise 3/src/Task.kt", variableArgumentListsExercise3.TaskKt::main);
}
@Test
public void testTask93() {
public void testTask92() {
testExample("../AtomicKotlinCourse/Introduction to Objects/Variable Argument Lists/Exercise 4/src/Task.kt", variableArgumentListsExercise4.TaskKt::main);
}
@Test
public void testTask94() {
public void testTask93() {
testExample("../AtomicKotlinCourse/Introduction to Objects/Variable Argument Lists/Exercise 6/src/Task.kt", varargArguments6.TaskKt::main);
}
@Test
public void testTask95() {
public void testTask94() {
testExample("../AtomicKotlinCourse/Introduction to Objects/Sets/Exercise 1/src/Task.kt", setsExercise1.TaskKt::main);
}
@Test
public void testTask96() {
public void testTask95() {
testExample("../AtomicKotlinCourse/Introduction to Objects/Sets/Exercise 2/src/Task.kt", setsExercise2.TaskKt::main);
}
@Test
public void testTask97() {
public void testTask96() {
testExample("../AtomicKotlinCourse/Introduction to Objects/Sets/Exercise 3/src/Task.kt", setsExercise3.TaskKt::main);
}
@Test
public void testTask98() {
public void testTask97() {
testExample("../AtomicKotlinCourse/Introduction to Objects/Sets/Exercise 4/src/Task.kt", sets4.TaskKt::main);
}
@Test
public void testTask99() {
public void testTask98() {
testExample("../AtomicKotlinCourse/Introduction to Objects/Maps/Exercise 1/src/Task.kt", mapsExercise1.TaskKt::main);
}
@Test
public void testTask100() {
public void testTask99() {
testExample("../AtomicKotlinCourse/Introduction to Objects/Maps/Exercise 2/src/Task.kt", mapsExercise2.TaskKt::main);
}
@Test
public void testTask101() {
public void testTask100() {
testExample("../AtomicKotlinCourse/Introduction to Objects/Maps/Exercise 3/src/Task.kt", mapsExercise3.TaskKt::main);
}
@Test
public void testTask102() {
public void testTask101() {
testExample("../AtomicKotlinCourse/Introduction to Objects/Maps/Exercise 4/src/Task.kt", maps4.TaskKt::main);
}
@Test
public void testTask103() {
public void testTask102() {
testExample("../AtomicKotlinCourse/Introduction to Objects/Property Accessors/Exercise 1/src/Task.kt", propertyAccessorsExercise1.TaskKt::main);
}
@Test
public void testTask104() {
public void testTask103() {
testExample("../AtomicKotlinCourse/Introduction to Objects/Property Accessors/Exercise 2/src/Task.kt", propertyAccessorsExercise2.TaskKt::main);
}
@Test
public void testTask105() {
public void testTask104() {
testExample("../AtomicKotlinCourse/Introduction to Objects/Property Accessors/Exercise 3/src/Task.kt", propertyAccessorsExercise3.TaskKt::main);
}
@Test
public void testTask106() {
public void testTask105() {
testExample("../AtomicKotlinCourse/Introduction to Objects/Property Accessors/Exercise 4/src/Task.kt", propertyAccessorsExercise4.TaskKt::main);
}
@Test
public void testTask107() {
public void testTask106() {
testExample("../AtomicKotlinCourse/Introduction to Objects/Property Accessors/Exercise 5/src/Task.kt", propertyAccessors5.TaskKt::main);
}
@Test
public void testTask108() {
public void testTask107() {
testExample("../AtomicKotlinCourse/Introduction to Objects/Summary 2/Exercise 2/src/Task.kt", summaryIIExercise2.TaskKt::main);
}
@Test
public void testTask109() {
public void testTask108() {
testExample("../AtomicKotlinCourse/Introduction to Objects/Summary 2/Exercise 3/src/Task.kt", summaryIIExercise3.TaskKt::main);
}
@Test
public void testTask110() {
public void testTask109() {
testExample("../AtomicKotlinCourse/Introduction to Objects/Summary 2/Exercise 4/src/Task.kt", summaryIIExercise4.TaskKt::main);
}
@Test
public void testTask111() {
public void testTask110() {
testExample("../AtomicKotlinCourse/Introduction to Objects/Summary 2/Exercise 7/src/Task.kt", summaryIIExercise7.TaskKt::main);
}
@Test
public void testTask112() {
public void testTask111() {
testExample("../AtomicKotlinCourse/Introduction to Objects/Summary 2/Exercise 9/src/Task.kt", summaryIIExercise9.TaskKt::main);
}
@Test
public void testTask113() {
public void testTask112() {
testExample("../AtomicKotlinCourse/Introduction to Objects/Summary 2/Exercise 11/src/Task.kt", summaryIIExercise11.TaskKt::main);
}
@Test
public void testTask114() {
public void testTask113() {
testExample("../AtomicKotlinCourse/Introduction to Objects/Summary 2/Exercise 13/src/Task.kt", summaryIIExercise13.TaskKt::main);
}
@Test
public void testTask115() {
public void testTask114() {
testExample("../AtomicKotlinCourse/Introduction to Objects/Summary 2/Exercise 14/src/Task.kt", summaryIIExercise14.TaskKt::main);
}
@Test
public void testTask116() {
public void testTask115() {
testExample("../AtomicKotlinCourse/Usability/break & continue/Exercise 1/src/Task.kt", breakAndContinueExercise1.TaskKt::main);
}
@Test
public void testTask117() {
public void testTask116() {
testExample("../AtomicKotlinCourse/Usability/break & continue/Exercise 2/src/Task.kt", breakAndContinueExercise2.TaskKt::main);
}
@Test
public void testTask118() {
public void testTask117() {
testExample("../AtomicKotlinCourse/Usability/break & continue/Exercise 3/src/Task.kt", breakAndContinueExercise3.TaskKt::main);
}
@Test
public void testTask119() {
public void testTask118() {
testExample("../AtomicKotlinCourse/Usability/Extension Functions/Exercise 1/src/Task.kt", extensionFunctionsExercise1.TaskKt::main);
}
@Test
public void testTask120() {
public void testTask119() {
testExample("../AtomicKotlinCourse/Usability/Extension Functions/Exercise 2/src/Task.kt", extensionFunctionsExercise2.TaskKt::main);
}
@Test
public void testTask121() {
public void testTask120() {
testExample("../AtomicKotlinCourse/Usability/Extension Functions/Exercise 3/src/Task.kt", extensionFunctionsExercise3.TaskKt::main);
}
@Test
public void testTask122() {
public void testTask121() {
testExample("../AtomicKotlinCourse/Usability/Extension Functions/Exercise 4/src/Task.kt", extensionFunctions4.TaskKt::main);
}
@Test
public void testTask123() {
public void testTask122() {
testExample("../AtomicKotlinCourse/Usability/Named & Default Arguments/Exercise 1/src/Task.kt", namedAndDefaultArgumentsExercise1.TaskKt::main);
}
@Test
public void testTask124() {
public void testTask123() {
testExample("../AtomicKotlinCourse/Usability/Named & Default Arguments/Exercise 2/src/Task.kt", namedAndDefaultArgumentsExercise2.TaskKt::main);
}
@Test
public void testTask125() {
public void testTask124() {
testExample("../AtomicKotlinCourse/Usability/Named & Default Arguments/Exercise 3/src/Task.kt", namedAndDefaultArgumentsExercise3.TaskKt::main);
}
@Test
public void testTask126() {
public void testTask125() {
testExample("../AtomicKotlinCourse/Usability/Named & Default Arguments/Exercise 4/src/Task.kt", namedandDefaultArguments4.TaskKt::main);
}
@Test
public void testTask127() {
public void testTask126() {
testExample("../AtomicKotlinCourse/Usability/Overloading/Exercise 1/src/Task.kt", overloadingExercise1.TaskKt::main);
}
@Test
public void testTask128() {
public void testTask127() {
testExample("../AtomicKotlinCourse/Usability/Overloading/Exercise 4/src/Task.kt", overloading4.TaskKt::main);
}
@Test
public void testTask129() {
public void testTask128() {
testExample("../AtomicKotlinCourse/Usability/when Expressions/Exercise 1/src/Task.kt", whenExpressionsExercise1.TaskKt::main);
}
@Test
public void testTask130() {
public void testTask129() {
testExample("../AtomicKotlinCourse/Usability/when Expressions/Exercise 2/src/Task.kt", whenExpressionsExercise2.TaskKt::main);
}
@Test
public void testTask131() {
public void testTask130() {
testExample("../AtomicKotlinCourse/Usability/when Expressions/Exercise 3/src/Task.kt", whenExpressionsExercise3.TaskKt::main);
}
@Test
public void testTask132() {
public void testTask131() {
testExample("../AtomicKotlinCourse/Usability/when Expressions/Exercise 4/src/Task.kt", whenExpressions4.TaskKt::main);
}
@Test
public void testTask133() {
public void testTask132() {
testExample("../AtomicKotlinCourse/Usability/Enumerations/Exercise 1/src/Task.kt", enumerationsExercise1.TaskKt::main);
}
@Test
public void testTask134() {
public void testTask133() {
testExample("../AtomicKotlinCourse/Usability/Enumerations/Exercise 2/src/Task.kt", enumerationsExercise2.TaskKt::main);
}
@Test
public void testTask135() {
public void testTask134() {
testExample("../AtomicKotlinCourse/Usability/Enumerations/Exercise 3/src/Task.kt", enumerationsExercise3.TaskKt::main);
}
@Test
public void testTask136() {
public void testTask135() {
testExample("../AtomicKotlinCourse/Usability/Data Classes/Exercise 2/src/Task.kt", dataClassesExercise2.TaskKt::main);
}
@Test
public void testTask137() {
public void testTask136() {
testExample("../AtomicKotlinCourse/Usability/Nullable Types/Exercise 1/src/Task.kt", nullableTypesExercise1.TaskKt::main);
}
@Test
public void testTask138() {
public void testTask137() {
testExample("../AtomicKotlinCourse/Usability/Nullable Types/Exercise 2/src/Task.kt", nullableTypesExercise2.TaskKt::main);
}
@Test
public void testTask139() {
public void testTask138() {
testExample("../AtomicKotlinCourse/Usability/Safe Calls & the Elvis Operator/Exercise 1/src/Task.kt", safeCallsAndTheElvisOperatorExercise1.TaskKt::main);
}
@Test
public void testTask140() {
public void testTask139() {
testExample("../AtomicKotlinCourse/Usability/Safe Calls & the Elvis Operator/Exercise 2/src/Task.kt", safeCallsAndTheElvisOperatorExercise2.TaskKt::main);
}
@Test
public void testTask141() {
public void testTask140() {
testExample("../AtomicKotlinCourse/Usability/Non-null Assertions/Exercise 1/src/Task.kt", nonNullAssertionsExercise1.TaskKt::main);
}
@Test
public void testTask142() {
public void testTask141() {
testExample("../AtomicKotlinCourse/Usability/Non-null Assertions/Exercise 2/src/Task.kt", nonNullAssertionsExercise2.TaskKt::main);
}
@Test
public void testTask143() {
public void testTask142() {
testExample("../AtomicKotlinCourse/Usability/Extensions for Nullable Types/Exercise 1/src/Task.kt", extensionsForNullableTypesExercise1.TaskKt::main);
}
@Test
public void testTask144() {
public void testTask143() {
testExample("../AtomicKotlinCourse/Usability/Extensions for Nullable Types/Exercise 2/src/Task.kt", extensionsForNullableTypesExercise2.TaskKt::main);
}
@Test
public void testTask145() {
public void testTask144() {
testExample("../AtomicKotlinCourse/Usability/Introduction to Generics/Exercise 1/src/Task.kt", introductionToGenericsExercise1.TaskKt::main);
}
@Test
public void testTask146() {
public void testTask145() {
testExample("../AtomicKotlinCourse/Usability/Introduction to Generics/Exercise 2/src/Task.kt", introductionToGenericsExercise2.TaskKt::main);
}
@Test
public void testTask147() {
public void testTask146() {
testExample("../AtomicKotlinCourse/Usability/Extension Properties/Exercise 1/src/Task.kt", extensionPropertiesExercise1.TaskKt::main);
}
@Test
public void testTask148() {
public void testTask147() {
testExample("../AtomicKotlinCourse/Functional Programming/Lambdas/Exercise 1/src/Task.kt", lambdasExercise1.TaskKt::main);
}
@Test
public void testTask149() {
public void testTask148() {
testExample("../AtomicKotlinCourse/Functional Programming/Lambdas/Exercise 2/src/Task.kt", lambdasExercise2.TaskKt::main);
}
@Test
public void testTask150() {
public void testTask149() {
testExample("../AtomicKotlinCourse/Functional Programming/Lambdas/Exercise 3/src/Task.kt", lambdasExercise3.TaskKt::main);
}
@Test
public void testTask151() {
public void testTask150() {
testExample("../AtomicKotlinCourse/Functional Programming/The Importance of Lambdas/Exercise 1/src/Task.kt", theImportanceOfLambdasExercise1.TaskKt::main);
}
@Test
public void testTask152() {
public void testTask151() {
testExample("../AtomicKotlinCourse/Functional Programming/The Importance of Lambdas/Exercise 2/src/Task.kt", theImportanceOfLambdasExercise2.TaskKt::main);
}
@Test
public void testTask153() {
public void testTask152() {
testExample("../AtomicKotlinCourse/Functional Programming/The Importance of Lambdas/Exercise 3/src/Task.kt", theImportanceOfLambdasExercise3.TaskKt::main);
}
@Test
public void testTask154() {
public void testTask153() {
testExample("../AtomicKotlinCourse/Functional Programming/Operations on Collections/Exercise 1/src/Task.kt", operationsOnCollectionsExercise1.TaskKt::main);
}
@Test
public void testTask155() {
public void testTask154() {
testExample("../AtomicKotlinCourse/Functional Programming/Operations on Collections/Exercise 2/src/Task.kt", operationsOnCollectionsExercise2.TaskKt::main);
}
@Test
public void testTask156() {
public void testTask155() {
testExample("../AtomicKotlinCourse/Functional Programming/Operations on Collections/Exercise 3/src/Task.kt", operationsOnCollectionsExercise3.TaskKt::main);
}
@Test
public void testTask157() {
public void testTask156() {
testExample("../AtomicKotlinCourse/Functional Programming/Operations on Collections/Exercise 4/src/Task.kt", operationsOnCollectionsExercise4.TaskKt::main);
}
@Test
public void testTask158() {
public void testTask157() {
testExample("../AtomicKotlinCourse/Functional Programming/Member References/Exercise 1/src/Task.kt", memberReferencesExercise1.TaskKt::main);
}
@Test
public void testTask159() {
public void testTask158() {
testExample("../AtomicKotlinCourse/Functional Programming/Member References/Exercise 2/src/Task.kt", memberReferencesExercise2.TaskKt::main);
}
@Test
public void testTask160() {
public void testTask159() {
testExample("../AtomicKotlinCourse/Functional Programming/Function Types/Exercise 1/src/Task.kt", functionTypesExercise1.TaskKt::main);
}
@Test
public void testTask161() {
public void testTask160() {
testExample("../AtomicKotlinCourse/Functional Programming/Function Types/Exercise 2/src/Task.kt", functionTypesExercise2.TaskKt::main);
}
@Test
public void testTask162() {
public void testTask161() {
testExample("../AtomicKotlinCourse/Functional Programming/Function Types/Exercise 3/src/Task.kt", functionTypesExercise3.TaskKt::main);
}
@Test
public void testTask163() {
public void testTask162() {
testExample("../AtomicKotlinCourse/Functional Programming/Function Types/Exercise 4/src/Task.kt", functionTypesExercise4.TaskKt::main);
}
@Test
public void testTask164() {
public void testTask163() {
testExample("../AtomicKotlinCourse/Functional Programming/Manipulating Lists/Exercise 1/src/Task.kt", manipulatingListsExercise1.TaskKt::main);
}
@Test
public void testTask165() {
public void testTask164() {
testExample("../AtomicKotlinCourse/Functional Programming/Manipulating Lists/Exercise 2/src/Task.kt", manipulatingListsExercise2.TaskKt::main);
}
@Test
public void testTask166() {
public void testTask165() {
testExample("../AtomicKotlinCourse/Functional Programming/Manipulating Lists/Exercise 3/src/Task.kt", manipulatingListsExercise3.TaskKt::main);
}
@Test
public void testTask167() {
public void testTask166() {
testExample("../AtomicKotlinCourse/Functional Programming/Manipulating Lists/Exercise 4/src/Task.kt", manipulatingListsExercise4.TaskKt::main);
}
@Test
public void testTask168() {
public void testTask167() {
testExample("../AtomicKotlinCourse/Functional Programming/Manipulating Lists/Exercise 5/src/Task.kt", manipulatingListsExercise5.TaskKt::main);
}
@Test
public void testTask169() {
public void testTask168() {
testExample("../AtomicKotlinCourse/Functional Programming/Manipulating Lists/Exercise 6/src/Task.kt", manipulatingListsExercise6.TaskKt::main);
}
@Test
public void testTask170() {
public void testTask169() {
testExample("../AtomicKotlinCourse/Functional Programming/Manipulating Lists/Exercise 7/src/Task.kt", manipulatingListsExercise7.TaskKt::main);
}
@Test
public void testTask171() {
public void testTask170() {
testExample("../AtomicKotlinCourse/Functional Programming/From Lists to Maps/Exercise 1/src/Task.kt", fromListsToMapsExercise1.TaskKt::main);
}
@Test
public void testTask172() {
public void testTask171() {
testExample("../AtomicKotlinCourse/Functional Programming/From Lists to Maps/Exercise 2/src/Task.kt", fromListsToMapsExercise2.TaskKt::main);
}
@Test
public void testTask173() {
public void testTask172() {
testExample("../AtomicKotlinCourse/Functional Programming/From Lists to Maps/Exercise 3/src/Task.kt", fromListsToMapsExercise3.TaskKt::main);
}
@Test
public void testTask174() {
public void testTask173() {
testExample("../AtomicKotlinCourse/Functional Programming/More Library Functions/Exercise 1/src/Task.kt", moreLibraryFunctionsExercise1.TaskKt::main);
}
@Test
public void testTask175() {
public void testTask174() {
testExample("../AtomicKotlinCourse/Functional Programming/More Library Functions/Exercise 2/src/Task.kt", moreLibraryFunctionsExercise2.TaskKt::main);
}
@Test
public void testTask176() {
public void testTask175() {
testExample("../AtomicKotlinCourse/Functional Programming/Functions Inside Functions/Exercise 1/src/Task.kt", functionsInsideFunctionsExercise1.TaskKt::main);
}
@Test
public void testTask177() {
public void testTask176() {
testExample("../AtomicKotlinCourse/Functional Programming/Folding Lists/Exercise 1/src/Task.kt", foldingListsExercise1.TaskKt::main);
}
@Test
public void testTask178() {
public void testTask177() {
testExample("../AtomicKotlinCourse/Functional Programming/Folding Lists/Exercise 2/src/Task.kt", foldingListsExercise2.TaskKt::main);
}
@Test
public void testTask179() {
public void testTask178() {
testExample("../AtomicKotlinCourse/Functional Programming/Folding Lists/Exercise 3/src/Task.kt", foldingListsExercise3.TaskKt::main);
}
@Test
public void testTask180() {
public void testTask179() {
testExample("../AtomicKotlinCourse/Functional Programming/Folding Lists/Exercise 4/src/Task.kt", foldingListsExercise4.TaskKt::main);
}
@Test
public void testTask181() {
public void testTask180() {
testExample("../AtomicKotlinCourse/Functional Programming/Recursion/Exercise 1/src/Task.kt", recursionExercise1.TaskKt::main);
}
@Test
public void testTask182() {
public void testTask181() {
testExample("../AtomicKotlinCourse/Functional Programming/Recursion/Exercise 2/src/Task.kt", recursionExercise2.TaskKt::main);
}
@Test
public void testTask183() {
public void testTask182() {
testExample("../AtomicKotlinCourse/Functional Programming/Recursion/Exercise 3/src/Task.kt", recursionExercise3.TaskKt::main);
}
@Test
public void testTask184() {
public void testTask183() {
testExample("../AtomicKotlinCourse/Functional Programming/Recursion/Exercise 4/src/Task.kt", recursionExercise4.TaskKt::main);
}
@ -3292,27 +3287,27 @@ public class TestAllExamples extends AbstractTestExamples {
}
@Test
public void testTask185() {
public void testTask184() {
testExample("../AtomicKotlinCourse/Power Tools/Lambda with Receiver/Exercise 1/src/Task.kt", lambdaWithReceiverExercise1.TaskKt::main);
}
@Test
public void testTask186() {
public void testTask185() {
testExample("../AtomicKotlinCourse/Power Tools/Lambda with Receiver/Exercise 2/src/Task.kt", lambdaWithReceiverExercise2.TaskKt::main);
}
@Test
public void testTask187() {
public void testTask186() {
testExample("../AtomicKotlinCourse/Power Tools/The with() Function/Exercise 1/src/Task.kt", theWithFunctionExercise1.TaskKt::main);
}
@Test
public void testTask188() {
public void testTask187() {
testExample("../AtomicKotlinCourse/Power Tools/The with() Function/Exercise 2/src/Task.kt", theWithFunctionExercise2.TaskKt::main);
}
@Test
public void testTask189() {
public void testTask188() {
testExample("../AtomicKotlinCourse/Power Tools/Hashing/Exercise 1/src/Task.kt", hashingExercise1.TaskKt::main);
}
}

View File

@ -120,10 +120,10 @@ class TestAllExercises : AbstractTestExercises() {
fun testExpressionsAndStatementsExercise3() = testClass(expressionsAndStatementsExercise3.TestExpressionsAndStatementsExercise3::class)
@Test
fun testSummaryIExercise1() = testClass(summaryIExercise1.TestSummaryIExercise1::class)
fun testSummaryIExercise1() = testOutput("../AtomicKotlinCourse/Programming Basics/Summary 1/Exercise 1/test/output.txt"){ summaryIExercise1.main() }
@Test
fun testSummaryIExercise2() = testOutput("../AtomicKotlinCourse/Programming Basics/Summary 1/Exercise 2/test/output.txt"){ summaryIExercise2.main() }
fun testSummaryIExercise2() = testClass(summaryIExercise2.TestSummaryIExercise2::class)
@Test
fun testSummaryIExercise3() = testClass(summaryIExercise3.TestSummaryIExercise3::class)
@ -149,15 +149,6 @@ class TestAllExercises : AbstractTestExercises() {
@Test
fun testSummaryIExercise10() = testClass(summaryIExercise10.TestSummaryIExercise10::class)
@Test
fun testSummaryIExercise11() = testClass(summaryIExercise11.TestSummaryIExercise11::class)
@Test
fun testSummaryIExercise12() = testClass(summaryIExercise12.TestSummaryIExercise12::class)
@Test
fun testSummaryIExercise13() = testClass(summaryIExercise13.TestSummaryIExercise13::class)
@Test
fun testObjectsEverywhereExercise1() = testClass(objectsEverywhereExercise1.TestObjectsEverywhereExercise1::class)