check50

cs50/problems/2023/x/substitution


:) substitution.c exists

Log
checking that substitution.c exists...

:) substitution.c compiles

Log
running clang substitution.c -o substitution -std=c11 -ggdb -lm -lcs50...

:( encrypts "A" as "Z" using ZYXWVUTSRQPONMLKJIHGFEDCBA as key

Cause
expected "ciphertext: Z\...", not "Ciphertext: Z\..."

Log
running ./substitution ZYXWVUTSRQPONMLKJIHGFEDCBA...
sending input A...
checking for output "ciphertext: Z\n"...

Expected Output:
ciphertext: Z
Actual Output:
Ciphertext: Z

:( encrypts "a" as "z" using ZYXWVUTSRQPONMLKJIHGFEDCBA as key

Cause
expected "ciphertext: z\...", not "Ciphertext: z\..."

Log
running ./substitution ZYXWVUTSRQPONMLKJIHGFEDCBA...
sending input a...
checking for output "ciphertext: z\n"...

Expected Output:
ciphertext: z
Actual Output:
Ciphertext: z

:( encrypts "ABC" as "NJQ" using NJQSUYBRXMOPFTHZVAWCGILKED as key

Cause
expected "ciphertext: NJ...", not "Ciphertext: NJ..."

Log
running ./substitution NJQSUYBRXMOPFTHZVAWCGILKED...
sending input ABC...
checking for output "ciphertext: NJQ\n"...

Expected Output:
ciphertext: NJQ
Actual Output:
Ciphertext: NJQ

:( encrypts "XyZ" as "KeD" using NJQSUYBRXMOPFTHZVAWCGILKED as key

Cause
expected "ciphertext: Ke...", not "Ciphertext: Ke..."

Log
running ./substitution NJQSUYBRXMOPFTHZVAWCGILKED...
sending input XyZ...
checking for output "ciphertext: KeD\n"...

Expected Output:
ciphertext: KeD
Actual Output:
Ciphertext: KeD

:( encrypts "This is CS50" as "Cbah ah KH50" using YUKFRNLBAVMWZTEOGXHCIPJSQD as key

Cause
expected "ciphertext: Cb...", not "Ciphertext: Cb..."

Log
running ./substitution YUKFRNLBAVMWZTEOGXHCIPJSQD...
sending input This is CS50...
checking for output "ciphertext: Cbah ah KH50\n"...

Expected Output:
ciphertext: Cbah ah KH50
Actual Output:
Ciphertext: Cbah ah KH50

:( encrypts "This is CS50" as "Cbah ah KH50" using yukfrnlbavmwzteogxhcipjsqd as key

Cause
expected "ciphertext: Cb...", not "Ciphertext: Cb..."

Log
running ./substitution yukfrnlbavmwzteogxhcipjsqd...
sending input This is CS50...
checking for output "ciphertext: Cbah ah KH50\n"...

Expected Output:
ciphertext: Cbah ah KH50
Actual Output:
Ciphertext: Cbah ah KH50

:( encrypts "This is CS50" as "Cbah ah KH50" using YUKFRNLBAVMWZteogxhcipjsqd as key

Cause
expected "ciphertext: Cb...", not "Ciphertext: Cb..."

Log
running ./substitution YUKFRNLBAVMWZteogxhcipjsqd...
sending input This is CS50...
checking for output "ciphertext: Cbah ah KH50\n"...

Expected Output:
ciphertext: Cbah ah KH50
Actual Output:
Ciphertext: Cbah ah KH50

:( encrypts all alphabetic characters using DWUSXNPQKEGCZFJBTLYROHIAVM as key

Cause
expected "ciphertext: Rq...", not "Ciphertext: Rq..."

Log
running ./substitution DWUSXNPQKEGCZFJBTLYROHIAVM...
sending input The quick brown fox jumps over the lazy dog...
checking for output "ciphertext: Rqx tokug wljif nja eozby jhxl rqx cdmv sjp\n"...

Expected Output:
ciphertext: Rqx tokug wljif nja eozby jhxl rqx cdmv sjp
Actual Output:
Ciphertext: Rqx tokug wljif nja eozby jhxl rqx cdmv sjp

:( does not encrypt non-alphabetical characters using DWUSXNPQKEGCZFJBTLYROHIAVM as key

Cause
expected "ciphertext: Yq...", not "Ciphertext: Yq..."

Log
running ./substitution DWUSXNPQKEGCZFJBTLYROHIAVM...
sending input Shh... Don't tell!...
checking for output "ciphertext: Yqq... Sjf'r rxcc!\n"...

Expected Output:
ciphertext: Yqq... Sjf'r rxcc!
Actual Output:
Ciphertext: Yqq... Sjf'r rxcc!

:) handles lack of key

Log
running ./substitution...
checking that program exited with status 1...

:) handles too many arguments

Log
running ./substitution abcdefghijklmnopqrstuvwxyz abc...
checking that program exited with status 1...

:) handles invalid key length

Log
running ./substitution QTXDGMKIPV...
checking that program exited with status 1...

:) handles invalid characters in key

Log
running ./substitution ZWGKPMJ^YISHFEXQON[DLUACVT...
checking that program exited with status 1...

:) handles duplicate characters in uppercase key

Log
running ./substitution FAZRDTMGQEJPWAXUSKVIYCLONH...
checking that program exited with status 1...

:) handles duplicate characters in lowercase key

Log
running ./substitution fazrdtmgqejpwaxuskviyclonh...
checking that program exited with status 1...

:) handles multiple duplicate characters in key

Log
running ./substitution MMCcEFGHIJKLMNOPqRqTUVWXeZ...
checking that program exited with status 1...