1########################################################### 2# 3# Test sort() 4# 5########################################################### 6 7body common control 8{ 9 inputs => { "../../default.cf.sub" }; 10 bundlesequence => { default($(this.promise_filename)) }; 11 version => "1.0"; 12} 13 14########################################################### 15 16bundle agent init 17{ 18 vars: 19 "a" slist => { "b", "c", "a" }; 20 "b" slist => { "100", "9", "10" }; 21 "c" slist => { }; 22 "d" slist => { "", "a", "", "b" }; 23 "e" slist => { "a", "1", "b" }; 24 "f" slist => { "0", "100.0", "0.1", "3.2" }; 25 "g" slist => { "", "-2.1", "0.88", "b", "00.88" }; 26 27 "ip" slist => { "100.200.100.0", "1.2.3.4", "9.7.5.1", "9", "9.7", "9.7.5", "", "-1", "where are the IP addresses?" }; 28 "ipv6" slist => { "FE80:0000:0000:0000:0202:B3FF:FE1E:8329", 29 "FE80::0202:B3FF:FE1E:8329", 30 "::1", 31 # the following should all be parsed as the same address and sorted together 32 "2001:db8:0:0:1:0:0:1", 33 "2001:0db8:0:0:1:0:0:1", 34 "2001:db8::1:0:0:1", 35 "2001:db8::0:1:0:0:1", 36 "2001:0db8::1:0:0:1", 37 "2001:db8:0:0:1::1", 38 "2001:db8:0000:0:1::1", 39 "2001:DB8:0:0:1::1", # note uppercase IPv6 addresses are invalid 40 # examples from https://www.ripe.net/lir-services/new-lir/ipv6_reference_card.pdf 41 "8000:63bf:3fff:fdd2", 42 "::ffff:192.0.2.47", 43 "fdf8:f53b:82e4::53", 44 "fe80::200:5aee:feaa:20a2", 45 "2001:0000:4136:e378:", 46 "8000:63bf:3fff:fdd2", 47 "2001:0002:6c::430", 48 "2001:10:240:ab::a", 49 "2002:cb0a:3cdd:1::1", 50 "2001:db8:8:4::2", 51 "ff01:0:0:0:0:0:0:2", 52 "-1", "where are the IP addresses?" }; 53 54 "mac" slist => { "00:14:BF:F7:23:1D", "0:14:BF:F7:23:1D", ":14:BF:F7:23:1D", "00:014:BF:0F7:23:01D", 55 "00:14:BF:F7:23:1D", "0:14:BF:F7:23:1D", ":14:BF:F7:23:1D", "00:014:BF:0F7:23:01D", 56 "01:14:BF:F7:23:1D", "1:14:BF:F7:23:1D", 57 "01:14:BF:F7:23:2D", "1:14:BF:F7:23:2D", 58 "-1", "where are the MAC addresses?" }; 59} 60 61bundle agent test 62{ 63 meta: 64 "test_soft_fail" string => "hpux|sunos_5_9|windows", 65 meta => { "redmine4934", "redmine5107" }; 66 67 68 vars: 69 "test" slist => { "a", "b", "c", "d", "e", "f", "g", "ip", "ipv6", "mac" }; 70 "sort" slist => { "lex", "int", "real", "IP", "MAC" }; 71 72 "$(sort)_sorted_$(test)" slist => sort("init.$(test)", $(sort)); 73 "inline_$(sort)_sorted" slist => sort('["b", "c", "a", "100", "9", "10"]', $(sort)); 74 "sorted_$(test)" slist => sort("init.$(test)"); # implicit "lex" 75} 76 77####################################################### 78 79bundle agent check 80{ 81 methods: 82 "check" usebundle => dcs_check_state(test, 83 "$(this.promise_filename).expected.json", 84 $(this.promise_filename)); 85} 86