tests/test_core_s2smanager.lua

Wed, 05 Jan 2011 03:03:40 +0000

author
Matthew Wild <mwild1@gmail.com>
date
Wed, 05 Jan 2011 03:03:40 +0000
changeset 3997
ed70d20fc133
parent 2923
b7049746bd29
permissions
-rw-r--r--

mod_saslauth: Use get_text() instead of directly accessing stanza child text nodes

1523
841d61be198f Remove version number from copyright headers
Matthew Wild <mwild1@gmail.com>
parents: 894
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
b1885732e979 GPL->MIT!
Matthew Wild <mwild1@gmail.com>
parents: 615
diff changeset
5 -- This project is MIT/X11 licensed. Please see the
b1885732e979 GPL->MIT!
Matthew Wild <mwild1@gmail.com>
parents: 615
diff changeset
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

mercurial