1#######################################################
2#
3# Test readstringlist() issue 364, also 366
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  files:
19      "$(G.testfile)"
20      delete => init_delete;
21
22      "$(G.testfile)"
23      create => "true",
24      edit_line => init_fill_in;
25}
26
27bundle edit_line init_fill_in
28{
29  insert_lines:
30      "123,,,456,789";        # "empty" fields
31}
32
33body delete init_delete
34{
35      dirlinks => "delete";
36      rmdirs   => "true";
37}
38
39#######################################################
40
41bundle agent test
42{
43  vars:
44      "nums" slist => readstringlist("$(G.testfile)","NoComment",",",5,100);
45      "sum" real => sum("nums");
46}
47
48#######################################################
49
50bundle agent check
51{
52  vars:
53      "nums" slist => { @{test.nums} };
54
55  classes:
56      "ok_list" not => strcmp("won't match", "$(nums)");
57      "ok123" expression => strcmp("123", "$(nums)");
58      "ok456" expression => strcmp("456", "$(nums)");
59      "ok789" expression => strcmp("789", "$(nums)");
60      "ok" and => { "ok_list", "ok123", "ok456", "ok789",
61                    islessthan("$(test.sum)", "1368.1"),
62                    isgreaterthan("$(test.sum)", "1367.9")
63      };
64
65  reports:
66    DEBUG::
67      "nums: $(nums)";
68      "sum: $(test.sum)";
69    ok::
70      "$(this.promise_filename) Pass";
71    !ok::
72      "$(this.promise_filename) FAIL";
73}
74
75