aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>2022-06-17 17:37:29 +0900
committer坂本 貴史 <o-takashi@sakamocchi.jp>2022-06-19 19:02:17 +0900
commit0af62f3580b5fce63e48a1278259eb60b02e6d9c (patch)
tree880d0f20d680043cfbdc2f3415cc1e26a3dfdef7
parent7d96b547b3c77221b9a1f8049aa93ccb312e4ae3 (diff)
downloadlibhinawa-0af62f3580b5fce63e48a1278259eb60b02e6d9c.tar.gz
tests: add test script for namespace and object functions
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
-rw-r--r--tests/helper.py8
-rw-r--r--tests/hinawa-functions35
-rw-r--r--tests/meson.build1
3 files changed, 44 insertions, 0 deletions
diff --git a/tests/helper.py b/tests/helper.py
index b845a70..69401ad 100644
--- a/tests/helper.py
+++ b/tests/helper.py
@@ -39,3 +39,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/hinawa-functions b/tests/hinawa-functions
new file mode 100644
index 0000000..8c4c755
--- /dev/null
+++ b/tests/hinawa-functions
@@ -0,0 +1,35 @@
+#!/usr/bin/env python3
+
+from sys import exit
+from errno import ENXIO
+
+import gi
+gi.require_version('Hinawa', '3.0')
+from gi.repository import Hinawa
+
+from helper import test_functions
+
+types = {
+ Hinawa.FwNodeError: (
+ 'quark',
+ ),
+ Hinawa.FwReqError: (
+ 'quark',
+ ),
+ Hinawa.FwRespError: (
+ 'quark',
+ ),
+ Hinawa.FwFcpError: (
+ 'quark',
+ ),
+ Hinawa.SndUnitError: (
+ 'quark',
+ ),
+ Hinawa.SndDiceError: (
+ '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 8bfd50d..8652c84 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -11,6 +11,7 @@ tests = [
'snd-tscm',
'hinawa-enum',
'snd-motu-register-dsp-parameter',
+ 'hinawa-functions',
]
envs = environment()