aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>2022-06-17 17:37:39 +0900
committer坂本 貴史 <o-takashi@sakamocchi.jp>2022-06-19 18:56:37 +0900
commit4e2af185a36ee4bbd8340f721fad0ec890fa469f (patch)
tree284f971a50bbfa0a053a87c3fc67914d1c6873c2
parent1f4c85b35f52b9f6e8fed59ec1f0808f0fc5d6e6 (diff)
downloadlibhinoko-4e2af185a36ee4bbd8340f721fad0ec890fa469f.tar.gz
tests: add test script for object functions
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
-rw-r--r--tests/helper.py8
-rw-r--r--tests/hinoko-functions29
-rw-r--r--tests/meson.build1
3 files changed, 38 insertions, 0 deletions
diff --git a/tests/helper.py b/tests/helper.py
index 5a42934..a7f9faa 100644
--- a/tests/helper.py
+++ b/tests/helper.py
@@ -52,3 +52,11 @@ def test_struct(target_type: object, methods: tuple[str]) -> bool:
print('Method {0} is not produced.'.format(method))
return False
return True
+
+
+def test_functions(target_type: object, functions: tuple[str]) -> bool:
+ for function in functions:
+ if not hasattr(target_type, function):
+ print('Function {0} is not produced.'.format(function))
+ return False
+ return True
diff --git a/tests/hinoko-functions b/tests/hinoko-functions
new file mode 100644
index 0000000..76750e2
--- /dev/null
+++ b/tests/hinoko-functions
@@ -0,0 +1,29 @@
+#!/usr/bin/env python3
+
+from sys import exit
+from errno import ENXIO
+
+import gi
+gi.require_version('Hinoko', '0.0')
+from gi.repository import Hinoko
+
+from helper import test_functions
+
+types = {
+ Hinoko.FwIsoResource: (
+ 'calculate_bandwidth',
+ ),
+ Hinoko.FwIsoCtxError: (
+ 'quark',
+ ),
+ Hinoko.FwIsoResourceError: (
+ 'quark',
+ ),
+ Hinoko.FwIsoResourceAutoError: (
+ 'quark',
+ ),
+}
+
+for target_type, functions in types.items():
+ if not test_functions(target_type, functions):
+ exit(ENXIO)
diff --git a/tests/meson.build b/tests/meson.build
index 43bab5f..4107b85 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -8,6 +8,7 @@ tests = [
'fw-iso-resource-auto',
'fw-iso-resource-once',
'cycle-timer',
+ 'hinoko-functions',
]
envs = environment()