Task Inject Url
Scan File ${URL_ICS} Settings={symbols_enabled = [TEST_INJECT_URL]}
- Expect Symbol TEST_INJECT_URL
\ No newline at end of file
+ Expect Symbol TEST_INJECT_URL
+
+Group Score Positive
+ Scan File ${MESSAGE} Settings={symbols_enabled = [GR_POSITIVE1, GR_POSITIVE2, GR_POSITIVE4, GR_POSITIVE8, GR_POSITIVE16]}
+ Expect Symbol With Score GR_POSITIVE1 1
+ Expect Symbol With Score GR_POSITIVE2 2
+ Expect Symbol With Score GR_POSITIVE4 4
+ Expect Symbol With Score GR_POSITIVE8 3
+ Expect Symbol With Score GR_POSITIVE16 0
+
+Group Score Negative
+ Scan File ${MESSAGE} Settings={symbols_enabled = [GR_NEGATIVE1, GR_NEGATIVE2, GR_NEGATIVE4, GR_NEGATIVE8]}
+ Expect Symbol With Score GR_NEGATIVE1 -1
+ Expect Symbol With Score GR_NEGATIVE2 -2
+ Expect Symbol With Score GR_NEGATIVE4 -4
+ Expect Symbol With Score GR_NEGATIVE8 -3
+
+Group Score Mix 1
+ Scan File ${MESSAGE} Settings={symbols_enabled = [GR_POSITIVE1, GR_POSITIVE2, GR_POSITIVE4, GR_POSITIVE8, GR_NEGATIVE1, GR_NEGATIVE2, GR_NEGATIVE4, GR_NEGATIVE8]}
+ Expect Symbol With Score GR_POSITIVE1 1
+ Expect Symbol With Score GR_POSITIVE2 2
+ Expect Symbol With Score GR_POSITIVE4 4
+ Expect Symbol With Score GR_POSITIVE8 3
+ Expect Symbol With Score GR_NEGATIVE1 -1
+ Expect Symbol With Score GR_NEGATIVE2 -2
+ Expect Symbol With Score GR_NEGATIVE4 -4
+ Expect Symbol With Score GR_NEGATIVE8 -8
+
+Group Score Mix 2
+ Scan File ${MESSAGE} Settings={symbols_enabled = [GR_POSITIVE1, GR_POSITIVE2, GR_POSITIVE4, GR_POSITIVE8, GR_NEGATIVE16]}
+ Expect Symbol With Score GR_POSITIVE1 1
+ Expect Symbol With Score GR_POSITIVE2 2
+ Expect Symbol With Score GR_POSITIVE4 4
+ Expect Symbol With Score GR_POSITIVE8 3
+ Expect Symbol With Score GR_NEGATIVE16 -16
+
+Group Score Mix 3
+ Scan File ${MESSAGE} Settings={symbols_enabled = [GR_POSITIVE1, GR_NEGATIVE16]}
+ Expect Symbol With Score GR_POSITIVE1 1
+ Expect Symbol With Score GR_NEGATIVE16 -11
+
+Group Score Mix 4
+ Scan File ${MESSAGE} Settings={symbols_enabled = [GR_POSITIVE16, GR_NEGATIVE16]}
+ Expect Symbol With Score GR_POSITIVE16 10
+ Expect Symbol With Score GR_NEGATIVE16 -16
\ No newline at end of file
--- /dev/null
+local true_cb_gen = function()
+ return function()
+ return true
+ end
+end
+
+local test_weights = { 1, 2, 4, 8, 16 }
+for _, i in ipairs(test_weights) do
+ rspamd_config:register_symbol('GR_POSITIVE' .. tostring(i), 1.0, true_cb_gen())
+
+ if i > 1 then
+ rspamd_config:register_dependency('GR_POSITIVE' .. tostring(i), 'GR_POSITIVE' .. tostring(i / 2))
+ end
+
+ rspamd_config:register_symbol('GR_NEGATIVE' .. tostring(i), 1.0, true_cb_gen())
+
+ if i > 1 then
+ rspamd_config:register_dependency('GR_NEGATIVE' .. tostring(i), 'GR_NEGATIVE' .. tostring(i / 2))
+ end
+end
+
+rspamd_config:register_dependency('GR_NEGATIVE1', 'GR_POSITIVE16')
\ No newline at end of file