tests/test_core_s2smanager.lua
author Matthew Wild <mwild1@gmail.com>
Wed, 01 May 2013 13:54:31 +0100
branchsasl
changeset 5555 70a7ef4b6aaa
parent 1523 841d61be198f
child 2713 1fc95582d74b
permissions -rw-r--r--
Close 'sasl' branch
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1523
841d61be198f Remove version number from copyright headers
Matthew Wild <mwild1@gmail.com>
parents: 896
diff changeset
     1
-- Prosody IM
760
90ce865eebd8 Update copyright notices for 2009
Matthew Wild <mwild1@gmail.com>
parents: 759
diff changeset
     2
-- Copyright (C) 2008-2009 Matthew Wild
90ce865eebd8 Update copyright notices for 2009
Matthew Wild <mwild1@gmail.com>
parents: 759
diff changeset
     3
-- Copyright (C) 2008-2009 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);
a43edbc848b9 Oops, never added the tests for s2smanager to the repo
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
    33
	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
    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);
a43edbc848b9 Oops, never added the tests for s2smanager to the repo
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
    39
	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
    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);
a43edbc848b9 Oops, never added the tests for s2smanager to the repo
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
    43
	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
    44
	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
    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