diff options
author | Yong Bakos <ybakos@humanoriented.com> | 2016-11-08 07:56:30 -0800 |
---|---|---|
committer | Pekka Paalanen <pekka.paalanen@collabora.co.uk> | 2016-11-18 16:21:19 +0200 |
commit | b0cd65deacb99c9cf0ca5c0c741307eb1f4a9c5e (patch) | |
tree | 5a3bab4cc1803d4b8c465c8852b7c66b14f93763 | |
parent | 0cdc3229b02ffa1863f48e21806f6a070937fb0b (diff) |
tests: Test wl_interface_equal
The test suite did not cover wl_interface_equal, so add one test that
specifically tests this method. Add the new test to Makefile.am.
Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
[Pekka: add assert(&wl_registry_interface != ©);]
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
-rw-r--r-- | Makefile.am | 3 | ||||
-rw-r--r-- | tests/interface-test.c | 50 |
2 files changed, 53 insertions, 0 deletions
diff --git a/Makefile.am b/Makefile.am index eea5aae..87bab0d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -151,6 +151,7 @@ built_test_programs = \ connection-test \ event-loop-test \ fixed-test \ + interface-test \ list-test \ map-test \ os-wrappers-test \ @@ -203,6 +204,8 @@ event_loop_test_SOURCES = tests/event-loop-test.c event_loop_test_LDADD = libtest-runner.la fixed_test_SOURCES = tests/fixed-test.c fixed_test_LDADD = libtest-runner.la +interface_test_SOURCES = tests/interface-test.c +interface_test_LDADD = libtest-runner.la list_test_SOURCES = tests/list-test.c list_test_LDADD = libtest-runner.la map_test_SOURCES = tests/map-test.c diff --git a/tests/interface-test.c b/tests/interface-test.c new file mode 100644 index 0000000..5290bb6 --- /dev/null +++ b/tests/interface-test.c @@ -0,0 +1,50 @@ +/* + * Copyright © 2016 Yong Bakos + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#include <assert.h> + +#include "wayland-client.h" +#include "wayland-private.h" +#include "test-runner.h" + +TEST(interface_equal) +{ + const struct wl_interface fake = { + "fake", 1, 0, NULL, 0, NULL + }; + const struct wl_interface fake_registry = { + "wl_registry", 1, 0, NULL, 0, NULL + }; + const struct wl_interface copy = wl_registry_interface; + + assert(&wl_registry_interface != ©); + + assert(wl_interface_equal(&wl_registry_interface, + &wl_registry_interface)); + assert(wl_interface_equal(&wl_registry_interface, ©)); + assert(wl_interface_equal(&wl_registry_interface, + &fake_registry)); + assert(!wl_interface_equal(&wl_registry_interface, &fake)); +} |