# tests/test_suiyue.py
import sys
import os
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))

from suiyue import suiyue_encode, suiyue_decode

# 测试函数必须以 test_ 开头
def test_encrypt_decrypt():  # 正确：以 test_ 开头
    plaintext = "测试随曰加密"
    password = "test_password"
    ciphertext = suiyue_encode(plaintext, password)
    decrypted = suiyue_decode(ciphertext, password)
    assert decrypted == plaintext, "加密解密不一致"

def test_default_password():  # 正确：以 test_ 开头
    plaintext = "默认密码测试"
    ciphertext = suiyue_encode(plaintext, "")  # 空密码使用默认值
    decrypted = suiyue_decode(ciphertext, "")
    assert decrypted == plaintext, "默认密码解密失败"