1 dnl @ ../doc/m4.texi:2978: Origin of test
2 dnl @ expected status: 0
4 dnl @ Copyright (C) 2006, 2007, 2008, 2009 Free Software
6 dnl @ This file is free software; the Free Software Foundation
7 dnl @ gives unlimited permission to copy and/or distribute it
8 dnl @ with or without modifications, as long as this notice
11 `ifelse(`$#', `1', `$1',
12 `ifelse($1, `$2', `$3',
13 `$0(shift(shift(shift($@))))')')')dnl
14 define(`side', `define(`counter', incr(counter))$1')dnl
16 `define(`counter', `0')dnl
17 ifelse(side(`$1'), `yes', `one comparison: ',
18 side(`$1'), `no', `two comparisons: ',
19 side(`$1'), `maybe', `three comparisons: ',
20 `side(`default answer: ')')counter')dnl
22 `define(`counter', `0')dnl
23 cond(`side(`$1')', `yes', `one comparison: ',
24 `side(`$1')', `no', `two comparisons: ',
25 `side(`$1')', `maybe', `three comparisons: ',
26 `side(`default answer: ')')counter')dnl
28 dnl @result{}one comparison: 3
30 dnl @result{}two comparisons: 3
32 dnl @result{}three comparisons: 3
33 example1(`feeling rather indecisive today')
34 dnl @result{}default answer: 4
36 dnl @result{}one comparison: 1
38 dnl @result{}two comparisons: 2
40 dnl @result{}three comparisons: 3
41 example2(`feeling rather indecisive today')
42 dnl @result{}default answer: 4