From 5c0cd75dab263e55d76369ed72b47a972fb3a747 Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Wed, 22 Aug 2012 00:26:49 +0200 Subject: [PATCH] Port monitor test from libzeitgeist1 diff --git a/test/direct/Makefile.am b/test/direct/Makefile.am index 667a005..6b6ea8d 100644 --- a/test/direct/Makefile.am +++ b/test/direct/Makefile.am @@ -16,6 +16,7 @@ TESTS = \ log-test \ marshalling-test \ mimetype-test \ + monitor-test \ query-operators-test \ table-lookup-test \ where-clause-test \ @@ -75,6 +76,9 @@ table-lookup-test: table-lookup-test.vala $(SRC_FILES) mimetype-test: mimetype-test.vala $(SRC_FILES) $(VALA_V)$(VALAC) $(VALAFLAGS) -o $@ $^ +monitor-test: monitor-test.vala $(SRC_FILES) + $(VALA_V)$(VALAC) $(VALAFLAGS) -o $@ $^ + clean-local: rm -f *.~[0-9]~ @@ -85,6 +89,7 @@ CLEANFILES = \ log-test \ marshalling-test \ mimetype-test \ + monitor-test \ query-operators-test \ table-lookup-test \ where-clause-test \ @@ -98,6 +103,7 @@ EXTRA_DIST = \ log-test.vala \ marshalling-test.vala \ mimetype-test.vala \ + monitor-test.vala \ query-operators-test.vala \ table-lookup-test.vala \ where-clause-test.vala \ diff --git a/test/direct/monitor-test.vala b/test/direct/monitor-test.vala new file mode 100644 index 0000000..e592221 --- /dev/null +++ b/test/direct/monitor-test.vala @@ -0,0 +1,43 @@ +/* datamodel-test.vala + * + * Copyright © 2012 Canonical Ltd. + * By Siegfried-A. Gevatter + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 2.1 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + */ + +using Zeitgeist; +using Assertions; + +int main (string[] argv) +{ + Test.init (ref argv); + + Test.add_func ("/Monitor/Create", monitor_create_test); + + return Test.run (); +} + +void monitor_create_test () +{ + var event_templates = new GenericArray (); + var mon = new Monitor (new TimeRange (27, 68), event_templates); + assert_cmpint (27, OperatorType.EQUAL, monitor.time_range.start); + assert_cmpint (68, OperatorType.EQUAL, monitor.time_range.end); + + assert (event_templates = monitor.event_templates); +} + +// vim:expandtab:ts=4:sw=4 -- 1.7.9.5