require "vnd.stalwart.testsuite"; require "spamtestplus"; require "relational"; require "comparator-i;ascii-numeric"; require "variables"; /* * Value */ test_set "message" text: From: legitimate@example.com To: victim@dovecot.example.net Subject: Not spammish Test! . ; test_config_set "sieve_spam_status_plus" "0"; test "Value percent: .00" { if not spamtest :percent :is "0" { if spamtest :percent :matches "*" { } test_fail "wrong percent spam value produced: ${1}"; } } test_config_set "sieve_spam_status_plus" "1"; test "Value percent: .01" { if spamtest :percent :is "0" { test_fail "spamtest not configured or test failed"; } if not spamtest :percent :is "1" { if spamtest :percent :matches "*" { } test_fail "wrong percent spam value produced: ${1}"; } } test_config_set "sieve_spam_status_plus" "13"; test "Value percent: .13" { if spamtest :percent :is "0" { test_fail "spamtest not configured or test failed"; } if not spamtest :percent :is "13" { if spamtest :percent :matches "*" { } test_fail "wrong percent spam value produced: ${1}"; } } test_config_set "sieve_spam_status_plus" "29"; test "Value percent: .29" { if spamtest :percent :is "0" { test_fail "spamtest not configured or test failed"; } if not spamtest :percent :is "29" { if spamtest :percent :matches "*" { } test_fail "wrong percent spam value produced: ${1}"; } } test_config_set "sieve_spam_status_plus" "51"; test "Value percent: .51" { if spamtest :percent :is "0" { test_fail "spamtest not configured or test failed"; } if not spamtest :percent :is "51" { if spamtest :percent :matches "*" { } test_fail "wrong percent spam value produced: ${1}"; } } test_config_set "sieve_spam_status_plus" "73"; test "Value percent: .73" { if spamtest :percent :is "0" { test_fail "spamtest not configured or test failed"; } if not spamtest :percent :is "73" { if spamtest :percent :matches "*" { } test_fail "wrong percent spam value produced: ${1}"; } } test_config_set "sieve_spam_status_plus" "89"; test "Value percent: .89" { if spamtest :percent :is "0" { test_fail "spamtest not configured or test failed"; } if not spamtest :percent :is "89" { if spamtest :percent :matches "*" { } test_fail "wrong percent spam value produced: ${1}"; } } test_config_set "sieve_spam_status_plus" "101"; test "Value percent: 1.01" { if spamtest :percent :is "0" { test_fail "spamtest not configured or test failed"; } if not spamtest :percent :is "100" { if spamtest :percent :matches "*" { } test_fail "wrong percent spam value produced: ${1}"; } }