Software /
code /
prosody
Annotate
tests/test_core_s2smanager.lua @ 578:5879264e28e2
Changed module manager to use multitable (initial commit)
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Sun, 07 Dec 2008 01:06:10 +0500 |
parent | 519:cccd610a0ef9 |
child | 615:4ae3e81513f3 |
rev | line source |
---|---|
519
cccd610a0ef9
Insert copyright/license headers
Matthew Wild <mwild1@gmail.com>
parents:
363
diff
changeset
|
1 -- Prosody IM v0.1 |
cccd610a0ef9
Insert copyright/license headers
Matthew Wild <mwild1@gmail.com>
parents:
363
diff
changeset
|
2 -- Copyright (C) 2008 Matthew Wild |
cccd610a0ef9
Insert copyright/license headers
Matthew Wild <mwild1@gmail.com>
parents:
363
diff
changeset
|
3 -- Copyright (C) 2008 Waqas Hussain |
cccd610a0ef9
Insert copyright/license headers
Matthew Wild <mwild1@gmail.com>
parents:
363
diff
changeset
|
4 -- |
cccd610a0ef9
Insert copyright/license headers
Matthew Wild <mwild1@gmail.com>
parents:
363
diff
changeset
|
5 -- This program is free software; you can redistribute it and/or |
cccd610a0ef9
Insert copyright/license headers
Matthew Wild <mwild1@gmail.com>
parents:
363
diff
changeset
|
6 -- modify it under the terms of the GNU General Public License |
cccd610a0ef9
Insert copyright/license headers
Matthew Wild <mwild1@gmail.com>
parents:
363
diff
changeset
|
7 -- as published by the Free Software Foundation; either version 2 |
cccd610a0ef9
Insert copyright/license headers
Matthew Wild <mwild1@gmail.com>
parents:
363
diff
changeset
|
8 -- of the License, or (at your option) any later version. |
cccd610a0ef9
Insert copyright/license headers
Matthew Wild <mwild1@gmail.com>
parents:
363
diff
changeset
|
9 -- |
cccd610a0ef9
Insert copyright/license headers
Matthew Wild <mwild1@gmail.com>
parents:
363
diff
changeset
|
10 -- This program is distributed in the hope that it will be useful, |
cccd610a0ef9
Insert copyright/license headers
Matthew Wild <mwild1@gmail.com>
parents:
363
diff
changeset
|
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
cccd610a0ef9
Insert copyright/license headers
Matthew Wild <mwild1@gmail.com>
parents:
363
diff
changeset
|
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
cccd610a0ef9
Insert copyright/license headers
Matthew Wild <mwild1@gmail.com>
parents:
363
diff
changeset
|
13 -- GNU General Public License for more details. |
cccd610a0ef9
Insert copyright/license headers
Matthew Wild <mwild1@gmail.com>
parents:
363
diff
changeset
|
14 -- |
cccd610a0ef9
Insert copyright/license headers
Matthew Wild <mwild1@gmail.com>
parents:
363
diff
changeset
|
15 -- You should have received a copy of the GNU General Public License |
cccd610a0ef9
Insert copyright/license headers
Matthew Wild <mwild1@gmail.com>
parents:
363
diff
changeset
|
16 -- along with this program; if not, write to the Free Software |
cccd610a0ef9
Insert copyright/license headers
Matthew Wild <mwild1@gmail.com>
parents:
363
diff
changeset
|
17 -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
cccd610a0ef9
Insert copyright/license headers
Matthew Wild <mwild1@gmail.com>
parents:
363
diff
changeset
|
18 -- |
cccd610a0ef9
Insert copyright/license headers
Matthew Wild <mwild1@gmail.com>
parents:
363
diff
changeset
|
19 |
cccd610a0ef9
Insert copyright/license headers
Matthew Wild <mwild1@gmail.com>
parents:
363
diff
changeset
|
20 |
363
a43edbc848b9
Oops, never added the tests for s2smanager to the repo
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
21 function compare_srv_priorities(csp) |
a43edbc848b9
Oops, never added the tests for s2smanager to the repo
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
22 local r1 = { priority = 10, weight = 0 } |
a43edbc848b9
Oops, never added the tests for s2smanager to the repo
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
23 local r2 = { priority = 100, weight = 0 } |
a43edbc848b9
Oops, never added the tests for s2smanager to the repo
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
24 local r3 = { priority = 1000, weight = 2 } |
a43edbc848b9
Oops, never added the tests for s2smanager to the repo
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
25 local r4 = { priority = 1000, weight = 2 } |
a43edbc848b9
Oops, never added the tests for s2smanager to the repo
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
26 local r5 = { priority = 1000, weight = 5 } |
a43edbc848b9
Oops, never added the tests for s2smanager to the repo
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
27 |
a43edbc848b9
Oops, never added the tests for s2smanager to the repo
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
28 assert_equal(csp(r1, r1), false); |
a43edbc848b9
Oops, never added the tests for s2smanager to the repo
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
29 assert_equal(csp(r1, r2), true); |
a43edbc848b9
Oops, never added the tests for s2smanager to the repo
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
30 assert_equal(csp(r1, r3), true); |
a43edbc848b9
Oops, never added the tests for s2smanager to the repo
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
31 assert_equal(csp(r1, r4), true); |
a43edbc848b9
Oops, never added the tests for s2smanager to the repo
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
32 assert_equal(csp(r1, r5), true); |
a43edbc848b9
Oops, never added the tests for s2smanager to the repo
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
33 |
a43edbc848b9
Oops, never added the tests for s2smanager to the repo
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
34 assert_equal(csp(r2, r1), false); |
a43edbc848b9
Oops, never added the tests for s2smanager to the repo
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
35 assert_equal(csp(r2, r2), false); |
a43edbc848b9
Oops, never added the tests for s2smanager to the repo
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
36 assert_equal(csp(r2, r3), true); |
a43edbc848b9
Oops, never added the tests for s2smanager to the repo
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
37 assert_equal(csp(r2, r4), true); |
a43edbc848b9
Oops, never added the tests for s2smanager to the repo
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
38 assert_equal(csp(r2, r5), true); |
a43edbc848b9
Oops, never added the tests for s2smanager to the repo
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
39 |
a43edbc848b9
Oops, never added the tests for s2smanager to the repo
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
40 assert_equal(csp(r3, r1), false); |
a43edbc848b9
Oops, never added the tests for s2smanager to the repo
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
41 assert_equal(csp(r3, r2), false); |
a43edbc848b9
Oops, never added the tests for s2smanager to the repo
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
42 assert_equal(csp(r3, r3), false); |
a43edbc848b9
Oops, never added the tests for s2smanager to the repo
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
43 assert_equal(csp(r3, r4), false); |
a43edbc848b9
Oops, never added the tests for s2smanager to the repo
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
44 assert_equal(csp(r3, r5), true); |
a43edbc848b9
Oops, never added the tests for s2smanager to the repo
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
45 |
a43edbc848b9
Oops, never added the tests for s2smanager to the repo
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
46 assert_equal(csp(r4, r1), false); |
a43edbc848b9
Oops, never added the tests for s2smanager to the repo
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
47 assert_equal(csp(r4, r2), false); |
a43edbc848b9
Oops, never added the tests for s2smanager to the repo
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
48 assert_equal(csp(r4, r3), false); |
a43edbc848b9
Oops, never added the tests for s2smanager to the repo
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
49 assert_equal(csp(r4, r4), false); |
a43edbc848b9
Oops, never added the tests for s2smanager to the repo
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
50 assert_equal(csp(r4, r5), true); |
a43edbc848b9
Oops, never added the tests for s2smanager to the repo
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
51 |
a43edbc848b9
Oops, never added the tests for s2smanager to the repo
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
52 assert_equal(csp(r5, r1), false); |
a43edbc848b9
Oops, never added the tests for s2smanager to the repo
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
53 assert_equal(csp(r5, r2), false); |
a43edbc848b9
Oops, never added the tests for s2smanager to the repo
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
54 assert_equal(csp(r5, r3), false); |
a43edbc848b9
Oops, never added the tests for s2smanager to the repo
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
55 assert_equal(csp(r5, r4), false); |
a43edbc848b9
Oops, never added the tests for s2smanager to the repo
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
56 assert_equal(csp(r5, r5), false); |
a43edbc848b9
Oops, never added the tests for s2smanager to the repo
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
57 |
a43edbc848b9
Oops, never added the tests for s2smanager to the repo
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
58 end |