[Forensics-changes] [yara] 60/135: Add more tests and remove unnecessary #undef directives
Hilko Bengen
bengen at moszumanska.debian.org
Sat Jul 1 10:27:32 UTC 2017
This is an automated email from the git hooks/post-receive script.
bengen pushed a commit to annotated tag v3.1.0
in repository yara.
commit 4ff1b4840cf007199f4e08af1a011507e54f9ffe
Author: Victor M. Alvarez <plusvic at gmail.com>
Date: Tue Jul 15 12:17:01 2014 +0200
Add more tests and remove unnecessary #undef directives
---
libyara/modules/pe.c | 2 --
libyara/modules/tests.c | 15 +++++++++++----
yara-python/tests.py | 6 +++++-
3 files changed, 16 insertions(+), 7 deletions(-)
diff --git a/libyara/modules/pe.c b/libyara/modules/pe.c
index 0772655..45a0836 100644
--- a/libyara/modules/pe.c
+++ b/libyara/modules/pe.c
@@ -333,5 +333,3 @@ int module_unload(YR_OBJECT* module)
{
return ERROR_SUCCESS;
}
-
-#undef MODULE_NAME
\ No newline at end of file
diff --git a/libyara/modules/tests.c b/libyara/modules/tests.c
index 2a38198..58000da 100644
--- a/libyara/modules/tests.c
+++ b/libyara/modules/tests.c
@@ -26,6 +26,9 @@ begin_declarations;
string("foo");
end_struct("constants");
+ integer_array("integer_array");
+ string_array("string_array");
+
begin_struct_array("struct_array");
integer("i");
string("s");
@@ -44,6 +47,14 @@ int module_load(
set_integer(1, module, "struct_array[1].i");
+ set_integer(0, module, "integer_array[%i]", 0);
+ set_integer(1, module, "integer_array[%i]", 1);
+ set_integer(2, module, "integer_array[%i]", 2);
+
+ set_string("foo", module, "string_array[%i]", 0);
+ set_string("bar", module, "string_array[%i]", 1);
+ set_string("baz", module, "string_array[%i]", 2);
+
return ERROR_SUCCESS;
}
@@ -52,7 +63,3 @@ int module_unload(YR_OBJECT* module)
{
return ERROR_SUCCESS;
}
-
-
-
-#undef MODULE_NAME
\ No newline at end of file
diff --git a/yara-python/tests.py b/yara-python/tests.py
index 1a47c72..caf7a78 100644
--- a/yara-python/tests.py
+++ b/yara-python/tests.py
@@ -698,7 +698,11 @@ class TestYara(unittest.TestCase):
'import "tests" rule test { condition: tests.constants.one + 1 == tests.constants.two }',
'import "tests" rule test { condition: tests.constants.foo == "foo" }',
'import "tests" rule test { condition: tests.struct_array[1].i == 1 }',
- 'import "tests" rule test { condition: tests.struct_array[0].i == 1 or true}'
+ 'import "tests" rule test { condition: tests.struct_array[0].i == 1 or true}',
+ 'import "tests" rule test { condition: tests.integer_array[0] == 0}',
+ 'import "tests" rule test { condition: tests.integer_array[1] == 1}',
+ 'import "tests" rule test { condition: tests.string_array[0] == "foo"}',
+ 'import "tests" rule test { condition: tests.string_array[2] == "baz"}',
])
self.assertFalseRules([
--
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