damnit
authorPierre Habouzit (MadCoder <pierre.habouzit@m4x.org>
Mon, 13 Dec 2004 16:32:55 +0000 (16:32 +0000)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Thu, 26 Jun 2008 21:26:39 +0000 (23:26 +0200)
git-archimport-id: opensource@polytechnique.org--2005/platal--mainline--0.9--patch-87

htdocs/TESTS/xorg_lists.php [new file with mode: 0644]

diff --git a/htdocs/TESTS/xorg_lists.php b/htdocs/TESTS/xorg_lists.php
new file mode 100644 (file)
index 0000000..1d3dbd1
--- /dev/null
@@ -0,0 +1,47 @@
+<?php
+require_once("__init__.php");
+require_once('include/lists.inc.php');
+
+class TestOfList extends UnitTestCase {
+    function TestOfList() {
+        $this->UnitTestCase('List functions');
+    }
+
+    function test_list_sort_owners() {
+        $l1 = Array('xavier.merlin.1998@polytechnique.org',
+                'xavier.merlin.1991@polytechnique.org',
+                'pierre.habouzit.2000@polytechnique.org',
+                'yann.chevalier.2000@polytechnique.org',
+                'foobar@baz.org');
+
+        $t = list_sort_owners($l1);
+        $this->assertIdentical($t[0][0]['l'], 'foobar@baz.org');
+
+        $t1991 = array_values($t[1991]);
+        $this->assertIdentical($t1991[0]['l'], 'xavier.merlin.1991');
+        
+        $t1998 = array_values($t[1998]);
+        $this->assertIdentical($t1998[0]['l'], 'xavier.merlin.1998');
+        
+        $t2000 = array_values($t[2000]);
+        $this->assertIdentical($t2000[0]['l'], 'yann.chevalier.2000');
+        $this->assertIdentical($t2000[1]['l'], 'pierre.habouzit.2000');
+        
+        $t = list_sort_owners($l1, false);
+        $this->assertIdentical($t[0][0]['l'], 'foobar@baz.org');
+
+        $tC = array_values($t['C']);
+        $this->assertIdentical($tC[0]['l'], 'yann.chevalier.2000');
+        
+        $tH = array_values($t['H']);
+        $this->assertIdentical($tH[0]['l'], 'pierre.habouzit.2000');
+
+        $tM = array_values($t['M']);
+        $this->assertIdentical($tM[0]['l'], 'xavier.merlin.1991');
+        $this->assertIdentical($tM[1]['l'], 'xavier.merlin.1998');
+    }
+}
+
+$test = &new TestOfList();
+$test->run($reporter);
+?>