Annotate

tests/test_core_s2smanager.lua @ 7220:2156aee1233e

Merge 0.10->trunk
author Kim Alvefur <zash@zash.se>
date Sun, 28 Feb 2016 20:05:56 +0100
parent 5776:bd0ff8ae98a8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
5776
bd0ff8ae98a8 Remove all trailing whitespace
Florian Zeitz <florob@babelmonkeys.de>
parents: 5604
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
5604
6df0ec991f2e tests: Some much-needed cleanup...
Matthew Wild <mwild1@gmail.com>
parents: 2923
diff changeset
9 env = {
6df0ec991f2e tests: Some much-needed cleanup...
Matthew Wild <mwild1@gmail.com>
parents: 2923
diff changeset
10 prosody = { events = require "util.events".new() };
6df0ec991f2e tests: Some much-needed cleanup...
Matthew Wild <mwild1@gmail.com>
parents: 2923
diff changeset
11 };
519
cccd610a0ef9 Insert copyright/license headers
Matthew Wild <mwild1@gmail.com>
parents: 363
diff changeset
12
363
a43edbc848b9 Oops, never added the tests for s2smanager to the repo
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
13 function compare_srv_priorities(csp)
a43edbc848b9 Oops, never added the tests for s2smanager to the repo
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
14 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
15 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
16 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
17 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
18 local r5 = { priority = 1000, weight = 5 }
5776
bd0ff8ae98a8 Remove all trailing whitespace
Florian Zeitz <florob@babelmonkeys.de>
parents: 5604
diff changeset
19
363
a43edbc848b9 Oops, never added the tests for s2smanager to the repo
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
20 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
21 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
22 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
23 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
24 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
25
a43edbc848b9 Oops, never added the tests for s2smanager to the repo
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
26 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
27 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
28 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
29 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
30 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
31
a43edbc848b9 Oops, never added the tests for s2smanager to the repo
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
32 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
33 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
34 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
35 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
36 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
37
a43edbc848b9 Oops, never added the tests for s2smanager to the repo
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
38 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
39 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
40 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
41 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
42 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
43
a43edbc848b9 Oops, never added the tests for s2smanager to the repo
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
44 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
45 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
46 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
47 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
48 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
49
a43edbc848b9 Oops, never added the tests for s2smanager to the repo
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
50 end