Executed features | Passed | Failures | Errors | Skipped | Success rate | Time |
---|---|---|---|---|---|---|
1 | 1 | 0 | 0 | 0 | 100.0% | 0.108 seconds |
Integration test for encoding the message
should encode message "#message"
Return
|
|||||||||||||||||
Given:
|
input and output file names
|
||||||||||||||||
def sourcePath = temp.resolve("source.txt") def targetPath = temp.resolve("target.bin") |
|||||||||||||||||
And:
|
a message written to the source text file
|
||||||||||||||||
Files.writeString(sourcePath, message) |
|||||||||||||||||
And:
|
configurations for input and output data files
|
||||||||||||||||
def source = new DataConfig(sourcePath, []) def target = new DataConfig(targetPath, []) |
|||||||||||||||||
And:
|
a coder and a transmitter are under the test
|
||||||||||||||||
@Subject def coder = new HammingEncoder() @Subject def transmitter = new Transmitter(coder, source, target) |
|||||||||||||||||
When:
|
we run the transmitter to encode the message
|
||||||||||||||||
transmitter.run() |
|||||||||||||||||
Then:
|
the transmitter creates a target binary file
|
||||||||||||||||
Files.exists(targetPath) |
|||||||||||||||||
And:
|
the target binary file is two times bigger then the source file
|
||||||||||||||||
Files.size(targetPath) == 2 * Files.size(sourcePath) |
|||||||||||||||||
And:
|
the target binary file has properly encoded message
|
||||||||||||||||
Files.readAllBytes(targetPath) == encoded |
|||||||||||||||||
Where:
|
the message and the encoded message as string with hex codes
|
||||||||||||||||
And:
|
expected content of the target binary file defined as
|
||||||||||||||||
encoded = hexParser.parseHex(hex) |
|||||||||||||||||
Examples:
|
|
3/3 passed
|