[Forensics-changes] [yara] 284/407: Add test cases for string comparison operators and floating point arithmetic operations
Hilko Bengen
bengen at moszumanska.debian.org
Sat Jul 1 10:28:37 UTC 2017
This is an automated email from the git hooks/post-receive script.
bengen pushed a commit to annotated tag v3.3.0
in repository yara.
commit 9784167509774c3619a9def198b2dfb8381c9fca
Author: Victor M. Alvarez <plusvic at gmail.com>
Date: Wed Dec 31 11:45:10 2014 +0100
Add test cases for string comparison operators and floating point arithmetic operations
---
yara-python/tests.py | 29 ++++++++++++++++++++++++++---
1 file changed, 26 insertions(+), 3 deletions(-)
diff --git a/yara-python/tests.py b/yara-python/tests.py
index f5e2b7a..163dac9 100644
--- a/yara-python/tests.py
+++ b/yara-python/tests.py
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2007-2013. The YARA Authors. All Rights Reserved.
+# Copyright (c) 2007-2014. The YARA Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -291,19 +291,42 @@ class TestYara(unittest.TestCase):
'rule test { condition: 1 < 2 }',
'rule test { condition: 2 >= 1 }',
'rule test { condition: 1 <= 1 }',
- 'rule test { condition: 1 == 1 }'
+ 'rule test { condition: 1 == 1 }',
+ 'rule test { condition: 1.5 == 1.5}',
+ 'rule test { condition: 1.0 == 1}',
+ 'rule test { condition: 1.5 >= 1.0}',
+ 'rule test { condition: 1.5 >= 1}',
+ 'rule test { condition: 1.0 >= 1}',
+ 'rule test { condition: 0.5 < 1}',
+ 'rule test { condition: 0.5 <= 1}',
+ 'rule rest { condition: 1.0 <= 1}',
+ 'rule rest { condition: "abc" == "abc"}',
+ 'rule rest { condition: "abc" <= "abc"}',
+ 'rule rest { condition: "abc" >= "abc"}',
+ 'rule rest { condition: "ab" < "abc"}',
+ 'rule rest { condition: "abc" > "ab"}',
+ 'rule rest { condition: "abc" < "abd"}',
+ 'rule rest { condition: "abd" > "abc"}',
])
self.assertFalseRules([
'rule test { condition: 1 != 1}',
+ 'rule test { condition: 1 != 1.0}',
'rule test { condition: 2 > 3}',
+ 'rule test { condition: 2.1 < 2}',
+ 'rule test { condition: "abc" != "abc"}',
+ 'rule test { condition: "abc" > "abc"}',
+ 'rule test { condition: "abc" < "abc"}',
])
def testArithmeticOperators(self):
self.assertTrueRules([
'rule test { condition: (1 + 1) * 2 == (9 - 1) \ 2 }',
- 'rule test { condition: 5 % 2 == 1 }'
+ 'rule test { condition: 5 % 2 == 1 }',
+ 'rule test { condition: 1.5 + 1.5 == 3}',
+ 'rule test { condition: 3 \ 2 == 1}',
+ 'rule test { condition: 3.0 \ 2 == 1.5}'
])
def testBitwiseOperators(self):
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/forensics/yara.git
More information about the forensics-changes
mailing list