diff --git a/gating.yaml b/gating.yaml new file mode 100644 index 0000000..6985029 --- /dev/null +++ b/gating.yaml @@ -0,0 +1,6 @@ +--- !Policy +product_versions: + - rhel-8 +decision_context: osci_compose_gate +rules: + - !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional} diff --git a/tests/smoke/runtest.sh b/tests/smoke/runtest.sh new file mode 100644 index 0000000..23a484f --- /dev/null +++ b/tests/smoke/runtest.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +python3 test_unicode_emoji.py + diff --git a/tests/smoke/test_unicode_emoji.py b/tests/smoke/test_unicode_emoji.py new file mode 100644 index 0000000..379d856 --- /dev/null +++ b/tests/smoke/test_unicode_emoji.py @@ -0,0 +1,70 @@ +from collections import defaultdict +import unittest +import sys + +class TestUnicodeEmoji(unittest.TestCase): + dir_path = "/usr/share/unicode/emoji/" + + def test_dummy(self): + self.assertEqual(True, True) + + @unittest.expectedFailure + def test_expected_failure(self): + self.assertEqual(False, True) + + def test_emoji_data(self): + self.parser(filename=self.dir_path+"emoji-data.txt") + + def test_emoji_sequences(self): + self.parser(filename=self.dir_path+"emoji-sequences.txt") + + def test_emoji_zwj_sequences(self): + self.parser(filename=self.dir_path+"emoji-zwj-sequences.txt") + + def parser(self, filename): + file_content = list() + report = defaultdict(dict) + with open(filename, "r") as fobj: + lines = fobj.readlines() + + count = 0 + curr_head = None + for line in lines: + + def count_group_emoji(line, count): + ''' + This function increments the count with the value inside "[ ]" + ''' + if "[" in line: + return count + int(line.split("[")[1].split("]")[0]) + return count + 1 + + if line.startswith("\n"): + continue + + elif count == 0 and not line.startswith("#"): + curr_head = line.split(";")[0].strip() + count = count_group_emoji(line , count) + report[curr_head]['actual_count'] = count + + elif line.startswith("# Total elements"): + report[curr_head]['expected_count'] = int(line.split(":")[1]) + count = 0 + + elif not line.startswith("#"): + count = count_group_emoji(line ,count) + report[curr_head]['actual_count'] = count + + print(report) + + def validate(report): + ''' + This function will validate if the actual_count equals expected_count + ''' + for key,data in report.items(): + self.assertEqual(data['actual_count'],data['expected_count']) + + validate(report) + +if __name__ == "__main__": + unittest.main() diff --git a/tests/tests.yml b/tests/tests.yml new file mode 100644 index 0000000..fba3ba4 --- /dev/null +++ b/tests/tests.yml @@ -0,0 +1,10 @@ +--- +- hosts: localhost + tags: + - classic + roles: + - role: standard-test-basic + tests: + - smoke + required_packages: + - python3