Report for lv.id.jc.correcter.TransmitterIntegrationSpec


Summary:

Created on Thu Jan 20 19:43:22 EET 2022 by jegors
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
See:

Features:

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:
message hex encoded
[] OK
T 4A98 [74, -104] OK
Test 4A98CC4A1E861E98 [74, -104, -52, 74, 30, -122, 30, -104] OK
3/3 passed