All Questions
Tagged with scala unit-testing
14 questions
7
votes
1
answer
179
views
Readable unit test - lists of complex objects
Goal: Writing more readable tests.
I have a couple of functions, which basically merge and converts two lists of Datasets together, written using Scala and Spark. Each of these Datasets has a lot of ...
5
votes
1
answer
264
views
Scala Docx generator from CSV input, using the docx4j library and Scala Swing
I am working on an application which takes as input a CSV file containing a list of attributes and a .docx template containing variable names equal to the columns ...
5
votes
1
answer
249
views
Bowling game Kata in Scala - pattern match
This is a functional approach to problem described by standard Bowling Game Kata - to implement the rules of calculating a score in a bowling game. The inspiration was the implementation by Uncle Bob: ...
2
votes
1
answer
1k
views
Hamming distance in Scala
Problem
Write a program that can calculate the Hamming difference between two DNA strands.
GAGCCTACTAACGGGAT
CATCGTAATGACGGCCT
^ ^ ^ ^ ^ ^^
Code
...
2
votes
1
answer
990
views
Anagram in Scala
Code
...
5
votes
3
answers
189
views
Nucleotide count in Scala
This is my second day in learning Scala and I still need to develop a taste of functional programming, I often find myself doing imperative coding. Below is the result of my TDD practice.
Code
...
6
votes
2
answers
620
views
String Calculator Kata in Scala
This is my solution of string calulator kata in scala(i'm new of tdd).
I'd like a general review of this.
String Calculator
Create a simple String calculator with a method int Add(string
...
4
votes
1
answer
302
views
White box input stream for creating test scenarios
I need to test a specialized input stream class that takes input from a TCP/IP network connection. I particularly need to ensure that the blocking and availability behavior is correct.
To help me ...
5
votes
1
answer
432
views
Safe cracker string with all combinations
Imagine a safe with a 4-digit code, and accepting a continuous stream of code entries, such that when the 4 digits are seen in the right sequence, the safe opens. Generate a short string that contains ...
4
votes
1
answer
328
views
Find minimum number of coins (count and list of coins too)
For a given set of denominations, you are asked to find the minimum number of coins with which a given amount of money can be paid. Assume that you can use as many coins of a particular denomination ...
11
votes
2
answers
5k
views
Sqrt (square root) function
As an exercise in learning Scala, I implemented a square root function like this:
...
5
votes
2
answers
3k
views
Reading and parsing CSV files
This is my first real attempt at a Scala program. I come from a predominantly Java background, so I'd like to know if the program sticks to Scala conventions well.
Is it well readable or should it ...
3
votes
0
answers
924
views
Testing Scala code which depends on objects
I am writing a small oauth2 library for Play! 2.1 scala. As I am still learning I got stuck trying to TDD and ended up writing the code first, then refactoring for testability. By testability I mean ...
16
votes
1
answer
591
views
TDD and function injection
I'm trying to come up with a scalable way of TDD'ing my Scala code, in particular managing dependencies. In this example, I've TDD'd part of the classic river crossing problem where we have people on ...