1####################################################### 2# 3# Test readintlist() with reals 4# 5####################################################### 6 7body common control 8{ 9 inputs => { "../../default.cf.sub" }; 10 bundlesequence => { default("$(this.promise_filename)") }; 11 version => "1.0"; 12} 13 14bundle agent init 15{ 16 files: 17 "$(G.testfile)" 18 delete => init_delete; 19 20 "$(G.testfile)" 21 create => "true", 22 edit_line => init_fill_in; 23} 24 25bundle edit_line init_fill_in 26{ 27 insert_lines: 28 "123.456"; 29 "789"; 30} 31 32body delete init_delete 33{ 34 dirlinks => "delete"; 35 rmdirs => "true"; 36} 37 38####################################################### 39 40bundle agent test 41{ 42 vars: 43 "nums" ilist => readintlist("$(G.testfile)","NoComment","\s+",5,100); 44 "sum" real => sum("nums"); 45} 46 47####################################################### 48 49bundle agent check 50{ 51 vars: 52 "nums" ilist => { @{test.nums} }; 53 54 classes: 55 "ok_list" not => strcmp("won't match", "$(nums)"); 56 "ok1" not => strcmp("123.456", "$(nums)"); 57 "ok2" not => strcmp("123", "$(nums)"); 58 # One failure and the readintlist aborts parsing the rest 59 "ok3" not => strcmp("789", "$(nums)"); 60 61 "ok" and => { "ok_list", "ok1", "ok2", "ok3" }; 62 63 reports: 64 DEBUG:: 65 "nums: $(nums)"; 66 "sum: $(test.sum)"; 67 ok:: 68 "$(this.promise_filename) Pass"; 69 70 !ok:: 71 "$(this.promise_filename) FAIL"; 72} 73