#Requires AutoHotkey v2.0 #Include libcrypt_v2.ahk2 passed := 0, failed := 0, report := "" Test(name, actual, expected) { global passed, failed, report if actual = expected passed++, report .= "PASS " name "`n" else failed++, report .= "FAIL " name "`n expected: " expected "`n actual: " actual "`n" } text := "Hello, Welt! 123 äöü" Test("ASCII2Bin", LC_Bin2Ascii(LC_ASCII2Bin("ABC")), "ABC") Test("BinStr UTF-8", LC_BinStr_DecodeText(LC_BinStr_EncodeText(text)), text) Test("Base64 UTF-8", LC_Base64_DecodeText(LC_Base64_EncodeText(text)), text) Test("ASCII85 original", LC_ASCII85_Decode(LC_ASCII85_Encode("Hello")), "Hello") Test("ASCII85 Z85", LC_ASCII85_Decode(LC_ASCII85_Encode("test", "z"), "z"), "test") Test("Caesar", LC_Caesar("Abc XyZ", 2), "Cde ZaB") Test("ROT5", LC_Rot5("a1239"), "a6784") Test("ROT13", LC_Rot13("Hello"), "Uryyb") Test("ROT18", LC_Rot18("Hello 123"), "Uryyb 678") Test("ROT47", LC_Rot47(LC_Rot47("Hello! 123")), "Hello! 123") Test("URI", LC_UriDecode(LC_UriEncode("ä & x")), "ä & x") Test("URL", LC_UrlDecode(LC_UrlEncode("https://example.com/a?x=ä")), "https://example.com/a?x=ä") Test("Div2", LC_Div2_decode(LC_Div2_encode("abcdef", false), false), "abcdef") MsgBox("Passed: " passed "`nFailed: " failed "`n`n" report, "libcrypt v2 tests") ExitApp()