Kotlinlearncs.online LogoJava
Return to List

Test Writing: Array Fill 3 Pattern

Created By: Geoffrey Challen
/ Version: 2022.7.0

Complete a method named arrayFill3Pattern that creates Int arrays filled with a 3-based pattern. Here are some examples:

1
1 4 7
4 7 10
1 4
4 7
7 10
10 13

And so on.

Your method should accept two int parameters: the number of rows and columns in the array. Both values will be positive. Return a two-dimensional Int array (Array<IntArray>) with the first index the rows and the second the column filled with the pattern as shown above.

Test Design Challenge

You're challenge is to write tests for this problem described above.

  • Provide a method named test that accepts no arguments and does not return a value.
  • If the implementation of the class described above is incorrect, your test method should throw an exception.
  • If it is correct, do not throw an exception.
  • You may want to use Kotlin's assert or check methods