1####################################################### 2# 3# Test canonifyuniquely() 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 "dummy" string => "dummy"; 20} 21 22####################################################### 23 24bundle agent test 25{ 26 vars: 27 28 "in1" string => "h?llo"; 29 "expect1" string => "h_llo_ad3f6fcf7063483c9d23b4b83c0b65df72e9f5cc"; 30 "out1" string => canonifyuniquely("$(in1)"); 31 32 "in2" string => "h/llo"; 33 "expect2" string => "h_llo_5d049ef5eaa0c5b4622eac3eee899132731bc034"; 34 "out2" string => canonifyuniquely("$(in2)"); 35 36 "in3" string => "/etc/passwd"; 37 "expect3" string => "_etc_passwd_b5cc3f676d00dd320d85ef41a5209fa0a99891ea"; 38 "out3" string => canonifyuniquely("$(in3)"); 39 40 "in4" string => "hello@mumble.com"; 41 "expect4" string => "hello_mumble_com_5050b0473d3e79adccfb885b8cbe3f44ed706987"; 42 "out4" string => canonifyuniquely("$(in4)"); 43 44 "in5" string => "!@#$%^&*()_-+={}[]\:;<>,?"; 45 "expect5" string => "__________________________55a3d62a602f37917827cbe044fcbb5da58f8df5"; 46 "out5" string => canonifyuniquely("$(in5)"); 47 48 "in6" string => "Eystein Måløy Stenberg"; 49 "expect6" string => "Eystein_M__l__y_Stenberg_f1d661c705209075cd873226cb131d2e27374357"; 50 "out6" string => canonifyuniquely("$(in6)"); 51 52 "in7" string => "$(in1) $(in1)"; 53 "expect7" string => "h_llo_h_llo_53750186dbccd2f8a512345c4a92ccc34d75267d"; 54 "out7" string => canonifyuniquely("$(in1) $(in1)"); 55 56 "in8" string => "'\"hello\"'"; 57 "expect8" string => "__hello___b2a2a0459a623c8e1cae32e88673ba4067106dc9"; 58 "out8" string => canonifyuniquely("$(in8)"); 59} 60 61####################################################### 62 63bundle agent check 64{ 65 classes: 66 "ok" and => { 67 strcmp("$(test.expect1)", "$(test.out1)"), 68 strcmp("$(test.expect2)", "$(test.out2)"), 69 strcmp("$(test.expect3)", "$(test.out3)"), 70 strcmp("$(test.expect4)", "$(test.out4)"), 71 strcmp("$(test.expect5)", "$(test.out5)"), 72 strcmp("$(test.expect6)", "$(test.out6)"), 73 strcmp("$(test.expect7)", "$(test.out7)"), 74 strcmp("$(test.expect8)", "$(test.out8)"), 75 }; 76 77 reports: 78 DEBUG:: 79 "Expected canonifyuniquely('$(test.in1)') => $(test.out1) == $(test.expect1)"; 80 "Expected canonifyuniquely('$(test.in2)') => $(test.out2) == $(test.expect2)"; 81 "Expected canonifyuniquely('$(test.in3)') => $(test.out3) == $(test.expect3)"; 82 "Expected canonifyuniquely('$(test.in4)') => $(test.out4) == $(test.expect4)"; 83 "Expected canonifyuniquely('$(test.in5)') => $(test.out5) == $(test.expect5)"; 84 "Expected canonifyuniquely('$(test.in6)') => $(test.out6) == $(test.expect6)"; 85 "Expected canonifyuniquely('$(test.in7)') => $(test.out7) == $(test.expect7)"; 86 "Expected canonifyuniquely('$(test.in8)') => $(test.out8) == $(test.expect8)"; 87 ok:: 88 "$(this.promise_filename) Pass"; 89 !ok:: 90 "$(this.promise_filename) FAIL"; 91} 92 93