KCC: beginning of tests for kcc.graph
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Tue, 5 May 2015 00:06:52 +0000 (12:06 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 12 Jun 2015 04:57:15 +0000 (06:57 +0200)
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
python/samba/tests/kcc/graph.py [new file with mode: 0644]

diff --git a/python/samba/tests/kcc/graph.py b/python/samba/tests/kcc/graph.py
new file mode 100644 (file)
index 0000000..e43667f
--- /dev/null
@@ -0,0 +1,39 @@
+# Unix SMB/CIFS implementation. Tests for kcc.graph routines
+# Copyright (C) Andrew Bartlett 2015
+#
+# Written by Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 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 General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+
+"""Tests for samba.kcc.graph"""
+
+import samba
+import samba.tests
+from samba.kcc.graph import *
+
+import itertools
+
+class GraphFunctionTests(samba.tests.TestCase):
+
+
+    def test_total_schedule(self):
+        schedule = [0x81] * 84
+        for schedule, total in (
+                ([0x81] * 84, 168),
+                ([0xff] * 84, 84 * 8),
+                ([0xaa] * 84, 84 * 4),
+                ([0x03, 0x33] * 42, 42 * 6),
+                (range(4) * 21, 21 * 5)):
+            self.assetEquals(total_schedule(schedule), total)