Beispiel #1
0
def check_stars():
    """Checking stars.sh output using random input."""
    num = random.randint(5,55)
    output = check50.run("./stars.sh " + str(num) + " > stars.out").stdout()
    
    if check50.hash("stars.out") != STARS_HASHES[num - 5]: #index for STARS_HASHES start at 0
        raise check50.Failure("Tried running ./stars.sh " + str(num) + ". The output is not correct.")
Beispiel #2
0
def different():
    """whodunit.c alters the image"""
    check50.include("clue.bmp")
    check50.run("./whodunit clue.bmp verdict.bmp").exit()
    if check50.hash("verdict.bmp") == check50.hash("clue.bmp"):
        raise check50.Failure("output image is identical to clue.bmp")
Beispiel #3
0
def audio_x2():
    """increases audio volume, factor of 2 correctly"""
    check50.run("./volume input.wav output.wav 2").exit(0)
    if check50.hash("output.wav") != HASHES[2]:
        raise check50.Failure("audio is not correctly altered, factor of 2")
Beispiel #4
0
def audio_tenth():
    """reduces audio volume, factor of 0.1 correctly"""
    check50.run("./volume input.wav output.wav 0.1").exit(0)
    if check50.hash("output.wav") != HASHES[1]:
        raise check50.Failure("audio is not correctly altered, factor of 0.1")
Beispiel #5
0
def check_analyze():
    """Checking analyze.sh"""
    output = check50.run("./analyze.sh sample.txt outfile.csv").stdout()
    if check50.hash("outfile.csv") != ANALYZE_HASHES[0]:
        raise check50.Failure("Tried running ./analyze.sh sample.txt outfile.csv. outfile.csv did not contain the correct data.")
Beispiel #6
0
def last_image():
    """recovers 049.jpg correctly"""
    check50.run("./recover card.raw").exit(0, timeout=10)
    if check50.hash("049.jpg") != HASHES[-1]:
        raise check50.Failure("recovered image does not match")
Beispiel #7
0
def middle_images():
    """recovers middle images correctly"""
    check50.run("./recover card.raw").exit(0, timeout=10)
    for i, hash in enumerate(HASHES[1:-1], 1):
        if hash != check50.hash("{:03d}.jpg".format(i)):
            raise check50.Failure("recovered image does not match")