Software /
code /
prosody
Annotate
tests/test_core_s2smanager.lua @ 3060:6c1cfb4cea3c
Merge 0.7->trunk
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Thu, 20 May 2010 10:48:44 +0100 |
parent | 2923:b7049746bd29 |
child | 5604:6df0ec991f2e |
rev | line source |
---|---|
1523
841d61be198f
Remove version number from copyright headers
Matthew Wild <mwild1@gmail.com>
parents:
896
diff
changeset
|
1 -- Prosody IM |
2923
b7049746bd29
Update copyright headers for 2010
Matthew Wild <mwild1@gmail.com>
parents:
2713
diff
changeset
|
2 -- Copyright (C) 2008-2010 Matthew Wild |
b7049746bd29
Update copyright headers for 2010
Matthew Wild <mwild1@gmail.com>
parents:
2713
diff
changeset
|
3 -- Copyright (C) 2008-2010 Waqas Hussain |
519
cccd610a0ef9
Insert copyright/license headers
Matthew Wild <mwild1@gmail.com>
parents:
363
diff
changeset
|
4 -- |
758 | 5 -- This project is MIT/X11 licensed. Please see the |
6 -- COPYING file in the source package for more information. | |
519
cccd610a0ef9
Insert copyright/license headers
Matthew Wild <mwild1@gmail.com>
parents:
363
diff
changeset
|
7 -- |
cccd610a0ef9
Insert copyright/license headers
Matthew Wild <mwild1@gmail.com>
parents:
363
diff
changeset
|
8 |
cccd610a0ef9
Insert copyright/license headers
Matthew Wild <mwild1@gmail.com>
parents:
363
diff
changeset
|
9 |
363
a43edbc848b9
Oops, never added the tests for s2smanager to the repo
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
10 function compare_srv_priorities(csp) |
a43edbc848b9
Oops, never added the tests for s2smanager to the repo
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
11 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
|
12 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
|
13 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
|
14 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
|
15 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
|
16 |
a43edbc848b9
Oops, never added the tests for s2smanager to the repo
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
17 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
|
18 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
|
19 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
|
20 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
|
21 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
|
22 |
a43edbc848b9
Oops, never added the tests for s2smanager to the repo
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
23 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
|
24 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
|
25 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
|
26 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
|
27 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
|
28 |
a43edbc848b9
Oops, never added the tests for s2smanager to the repo
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
29 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
|
30 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
|
31 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
|
32 assert_equal(csp(r3, r4), false); |
2713
1fc95582d74b
tests/test_core_s2smanager.lua: Fix to compare SRV weights correctly
Matthew Wild <mwild1@gmail.com>
parents:
1523
diff
changeset
|
33 assert_equal(csp(r3, r5), false); |
363
a43edbc848b9
Oops, never added the tests for s2smanager to the repo
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
34 |
a43edbc848b9
Oops, never added the tests for s2smanager to the repo
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
35 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
|
36 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
|
37 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
|
38 assert_equal(csp(r4, r4), false); |
2713
1fc95582d74b
tests/test_core_s2smanager.lua: Fix to compare SRV weights correctly
Matthew Wild <mwild1@gmail.com>
parents:
1523
diff
changeset
|
39 assert_equal(csp(r4, r5), false); |
363
a43edbc848b9
Oops, never added the tests for s2smanager to the repo
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
40 |
a43edbc848b9
Oops, never added the tests for s2smanager to the repo
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
41 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
|
42 assert_equal(csp(r5, r2), false); |
2713
1fc95582d74b
tests/test_core_s2smanager.lua: Fix to compare SRV weights correctly
Matthew Wild <mwild1@gmail.com>
parents:
1523
diff
changeset
|
43 assert_equal(csp(r5, r3), true); |
1fc95582d74b
tests/test_core_s2smanager.lua: Fix to compare SRV weights correctly
Matthew Wild <mwild1@gmail.com>
parents:
1523
diff
changeset
|
44 assert_equal(csp(r5, r4), true); |
363
a43edbc848b9
Oops, never added the tests for s2smanager to the repo
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
45 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
|
46 |
a43edbc848b9
Oops, never added the tests for s2smanager to the repo
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
47 end |