diff options
| author | Paulo Custodio <pauloscustodio@gmail.com> | 2021-01-26 22:08:55 +0000 |
|---|---|---|
| committer | Paulo Custodio <pauloscustodio@gmail.com> | 2021-01-28 00:49:29 +0000 |
| commit | 31934ba14c58fd3cab79cbd8dbea53a61d3fdbba (patch) | |
| tree | 8abe28c6a550ae83bbe13e78acaa9a7fc86fc493 /challenge-002 | |
| parent | 1dafe860df62fd84cfced9042ec742d6b368381f (diff) | |
| download | perlweeklychallenge-club-31934ba14c58fd3cab79cbd8dbea53a61d3fdbba.tar.gz perlweeklychallenge-club-31934ba14c58fd3cab79cbd8dbea53a61d3fdbba.tar.bz2 perlweeklychallenge-club-31934ba14c58fd3cab79cbd8dbea53a61d3fdbba.zip | |
remove tabs
Diffstat (limited to 'challenge-002')
| -rw-r--r-- | challenge-002/paulo-custodio/basic/ch-1.bas | 2 | ||||
| -rw-r--r-- | challenge-002/paulo-custodio/basic/ch-2.bas | 92 | ||||
| -rw-r--r-- | challenge-002/paulo-custodio/c/ch-1.c | 12 | ||||
| -rw-r--r-- | challenge-002/paulo-custodio/c/ch-2.c | 126 | ||||
| -rw-r--r-- | challenge-002/paulo-custodio/cpp/ch-1.cpp | 12 | ||||
| -rw-r--r-- | challenge-002/paulo-custodio/cpp/ch-2.cpp | 100 | ||||
| -rw-r--r-- | challenge-002/paulo-custodio/forth/ch-1.fs | 20 | ||||
| -rw-r--r-- | challenge-002/paulo-custodio/forth/ch-2.fs | 32 | ||||
| -rw-r--r-- | challenge-002/paulo-custodio/lua/ch-2.lua | 48 | ||||
| -rw-r--r-- | challenge-002/paulo-custodio/perl/ch-2.pl | 2 | ||||
| -rw-r--r-- | challenge-002/paulo-custodio/python/ch-2.py | 74 | ||||
| -rw-r--r-- | challenge-002/paulo-custodio/test.pl | 52 |
12 files changed, 286 insertions, 286 deletions
diff --git a/challenge-002/paulo-custodio/basic/ch-1.bas b/challenge-002/paulo-custodio/basic/ch-1.bas index 92b3820d80..2b7b94e5f5 100644 --- a/challenge-002/paulo-custodio/basic/ch-1.bas +++ b/challenge-002/paulo-custodio/basic/ch-1.bas @@ -6,6 +6,6 @@ dim num as string num = command(1) do while len(num)>1 and left(num,1)="0" - num = mid(num,2) + num = mid(num,2) loop print num diff --git a/challenge-002/paulo-custodio/basic/ch-2.bas b/challenge-002/paulo-custodio/basic/ch-2.bas index 0e4ab51a02..090979f9a4 100644 --- a/challenge-002/paulo-custodio/basic/ch-2.bas +++ b/challenge-002/paulo-custodio/basic/ch-2.bas @@ -2,68 +2,68 @@ ' ' Challenge #2 ' Write a script that can convert integers to and from a base35 -' representation, using the characters 0-9 and A-Y. Dave Jacoby came up +' representation, using the characters 0-9 and A-Y. Dave Jacoby came up ' with nice description about base35, in case you needed some background. function format_digit(n as integer) as string - if n<10 then - format_digit = chr(n+asc("0")) - else - format_digit = chr(n+asc("A")-10) - end if + if n<10 then + format_digit = chr(n+asc("0")) + else + format_digit = chr(n+asc("A")-10) + end if end function function format_number(n as integer, radix as integer) as string - dim negative as boolean, text as string, d as integer - if n<0 then - negative = true - n = -n - end if - do - d = n mod radix - n = int(n / radix) - text = format_digit(d) & text - loop while n > 0 - if negative then - text = "-" & text - end if - format_number = text + dim negative as boolean, text as string, d as integer + if n<0 then + negative = true + n = -n + end if + do + d = n mod radix + n = int(n / radix) + text = format_digit(d) & text + loop while n > 0 + if negative then + text = "-" & text + end if + format_number = text end function function scan_digit(c as string) as integer - if c >= "0" and c < "9" then - scan_digit = asc(c)-asc("0") - elseif ucase(c) >= "A" and ucase(c) <= "Z" then - scan_digit = asc(ucase(c))-asc("A")+10 - else - scan_digit = -1 - end if + if c >= "0" and c < "9" then + scan_digit = asc(c)-asc("0") + elseif ucase(c) >= "A" and ucase(c) <= "Z" then + scan_digit = asc(ucase(c))-asc("A")+10 + else + scan_digit = -1 + end if end function function scan_number(text as string, radix as integer) as integer - dim negative as boolean, n as integer, i as integer, d as integer - if left(text,1) = "-" then - negative = true - text = mid(text, 2) - end if - for i=1 to len(text) - d = scan_digit(mid(text,i,1)) - if d < 0 or d >= radix then - print "invalid number" - end - end if - n = n*radix + d - next i - if negative then - n = -n - end if - scan_number = n + dim negative as boolean, n as integer, i as integer, d as integer + if left(text,1) = "-" then + negative = true + text = mid(text, 2) + end if + for i=1 to len(text) + d = scan_digit(mid(text,i,1)) + if d < 0 or d >= radix then + print "invalid number" + end + end if + n = n*radix + d + next i + if negative then + n = -n + end if + scan_number = n end function ' main if command(1) = "-r" then - print scan_number(command(2), 35) + print scan_number(command(2), 35) else - print format_number(val(command(1)), 35) + print format_number(val(command(1)), 35) end if diff --git a/challenge-002/paulo-custodio/c/ch-1.c b/challenge-002/paulo-custodio/c/ch-1.c index 8f30197217..76799b43db 100644 --- a/challenge-002/paulo-custodio/c/ch-1.c +++ b/challenge-002/paulo-custodio/c/ch-1.c @@ -9,10 +9,10 @@ Write a script or one-liner to remove leading zeros from positive numbers. #include <ctype.h> int main(int argc, char* argv[]) { - if (argc==2) { - char* p = argv[1]; - while (*p=='0' && isdigit(p[1])) - p++; - printf("%s\n", p); - } + if (argc==2) { + char* p = argv[1]; + while (*p=='0' && isdigit(p[1])) + p++; + printf("%s\n", p); + } } diff --git a/challenge-002/paulo-custodio/c/ch-2.c b/challenge-002/paulo-custodio/c/ch-2.c index d034ce8a29..65ea1c5c20 100644 --- a/challenge-002/paulo-custodio/c/ch-2.c +++ b/challenge-002/paulo-custodio/c/ch-2.c @@ -15,86 +15,86 @@ with nice description about base35, in case you needed some background. #include <ctype.h> void* check_mem(void* p) { - if (!p) { - fputs("out of memory", stderr); - exit(EXIT_FAILURE); - } - return p; + if (!p) { + fputs("out of memory", stderr); + exit(EXIT_FAILURE); + } + return p; } // format a digit char format_digit(int n) { - if (n < 10) - return '0' + n; - else - return 'A' + n - 10; + if (n < 10) + return '0' + n; + else + return 'A' + n - 10; } // format a number - user must free buffer char* format_number(int n, int base) { - bool negative = false; - char* str = check_mem(strdup("")); - if (n < 0) { - negative = true; - n = -n; - } - do { - int d = n % base; - n = n / base; - str = check_mem(realloc(str, strlen(str) + 2)); - memmove(str + 1, str, strlen(str) + 1); - str[0] = format_digit(d); - } while (n > 0); - if (negative) { - str = check_mem(realloc(str, strlen(str) + 2)); - memmove(str + 1, str, strlen(str) + 1); - str[0] = '-'; - } - return str; + bool negative = false; + char* str = check_mem(strdup("")); + if (n < 0) { + negative = true; + n = -n; + } + do { + int d = n % base; + n = n / base; + str = check_mem(realloc(str, strlen(str) + 2)); + memmove(str + 1, str, strlen(str) + 1); + str[0] = format_digit(d); + } while (n > 0); + if (negative) { + str = check_mem(realloc(str, strlen(str) + 2)); + memmove(str + 1, str, strlen(str) + 1); + str[0] = '-'; + } + return str; } // scan digit int scan_digit(char c) { - if (isdigit(c)) - return c - '0'; - else if (isalpha(c)) - return toupper(c) - 'A' + 10; - else - return -1; + if (isdigit(c)) + return c - '0'; + else if (isalpha(c)) + return toupper(c) - 'A' + 10; + else + return -1; } // scan number int scan_number(const char* p, int base) { - bool negative = false; - int n = 0; - if (*p == '-') { - negative = true; - p++; - } - while (*p != '\0') { - int d = scan_digit(*p++); - if (d < 0 || d >= base) { - fputs("invalid number", stderr); - exit(EXIT_FAILURE); - } - n = n * base + d; - } - if (negative) - n = -n; - return n; + bool negative = false; + int n = 0; + if (*p == '-') { + negative = true; + p++; + } + while (*p != '\0') { + int d = scan_digit(*p++); + if (d < 0 || d >= base) { + fputs("invalid number", stderr); + exit(EXIT_FAILURE); + } + n = n * base + d; + } + if (negative) + n = -n; + return n; } int main(int argc, char* argv[]) { - if (argc == 2) { - char* num = format_number(atoi(argv[1]), 35); - puts(num); - free(num); - } - else if (argc == 3 && strcmp(argv[1], "-r") == 0) { - printf("%d\n", scan_number(argv[2], 35)); - } - else { - fputs("Usage: ch-2 [-r] number", stderr); - return EXIT_FAILURE; - } + if (argc == 2) { + char* num = format_number(atoi(argv[1]), 35); + puts(num); + free(num); + } + else if (argc == 3 && strcmp(argv[1], "-r") == 0) { + printf("%d\n", scan_number(argv[2], 35)); + } + else { + fputs("Usage: ch-2 [-r] number", stderr); + return EXIT_FAILURE; + } } diff --git a/challenge-002/paulo-custodio/cpp/ch-1.cpp b/challenge-002/paulo-custodio/cpp/ch-1.cpp index 8b438a2a1c..1399dfe279 100644 --- a/challenge-002/paulo-custodio/cpp/ch-1.cpp +++ b/challenge-002/paulo-custodio/cpp/ch-1.cpp @@ -9,10 +9,10 @@ Write a script or one-liner to remove leading zeros from positive numbers. #include <cctype> int main(int argc, char* argv[]) { - if (argc==2) { - char* p = argv[1]; - while (*p=='0' && isdigit(p[1])) - p++; - std::cout << p << std::endl; - } + if (argc==2) { + char* p = argv[1]; + while (*p=='0' && isdigit(p[1])) + p++; + std::cout << p << std::endl; + } } diff --git a/challenge-002/paulo-custodio/cpp/ch-2.cpp b/challenge-002/paulo-custodio/cpp/ch-2.cpp index 0745e32612..8a3510766b 100644 --- a/challenge-002/paulo-custodio/cpp/ch-2.cpp +++ b/challenge-002/paulo-custodio/cpp/ch-2.cpp @@ -13,69 +13,69 @@ with nice description about base35, in case you needed some background. // format a digit char format_digit(int n) { - if (n < 10) - return '0' + n; - else - return 'A' + n - 10; + if (n < 10) + return '0' + n; + else + return 'A' + n - 10; } // format a number std::string format_number(int n, int base) { - bool negative = false; - std::string str; - if (n < 0) { - negative = true; - n = -n; - } - do { - int d = n % base; - n = n / base; - str.insert(0, 1, format_digit(d)); - } while (n > 0); - if (negative) - str.insert(0, 1, '-'); - return str; + bool negative = false; + std::string str; + if (n < 0) { + negative = true; + n = -n; + } + do { + int d = n % base; + n = n / base; + str.insert(0, 1, format_digit(d)); + } while (n > 0); + if (negative) + str.insert(0, 1, '-'); + return str; } // scan digit int scan_digit(char c) { - if (isdigit(c)) - return c - '0'; - else if (isalpha(c)) - return toupper(c) - 'A' + 10; - else - return -1; + if (isdigit(c)) + return c - '0'; + else if (isalpha(c)) + return toupper(c) - 'A' + 10; + else + return -1; } // scan number int scan_number(const std::string& str, int base) { - const char* p = str.c_str(); - bool negative = false; - int n = 0; - if (*p == '-') { - negative = true; - p++; - } - while (*p != '\0') { - int d = scan_digit(*p++); - if (d < 0 || d >= base) { - std::cerr << "invalid number" << std::endl; - exit(EXIT_FAILURE); - } - n = n * base + d; - } - if (negative) - n = -n; - return n; + const char* p = str.c_str(); + bool negative = false; + int n = 0; + if (*p == '-') { + negative = true; + p++; + } + while (*p != '\0') { + int d = scan_digit(*p++); + if (d < 0 || d >= base) { + std::cerr << "invalid number" << std::endl; + exit(EXIT_FAILURE); + } + n = n * base + d; + } + if (negative) + n = -n; + return n; } int main(int argc, char* argv[]) { - if (argc == 2) - std::cout << format_number(atoi(argv[1]), 35) << std::endl; - else if (argc == 3 && std::string(argv[1]) == "-r") - std::cout << scan_number(argv[2], 35) << std::endl; - else { - std::cerr << "Usage: ch-2 [-r] number" << std::endl; - return EXIT_FAILURE; - } + if (argc == 2) + std::cout << format_number(atoi(argv[1]), 35) << std::endl; + else if (argc == 3 && std::string(argv[1]) == "-r") + std::cout << scan_number(argv[2], 35) << std::endl; + else { + std::cerr << "Usage: ch-2 [-r] number" << std::endl; + return EXIT_FAILURE; + } } diff --git a/challenge-002/paulo-custodio/forth/ch-1.fs b/challenge-002/paulo-custodio/forth/ch-1.fs index 1fc8fb8563..9cc2f9f03d 100644 --- a/challenge-002/paulo-custodio/forth/ch-1.fs +++ b/challenge-002/paulo-custodio/forth/ch-1.fs @@ -1,19 +1,19 @@ #! /usr/bin/env gforth \ Challenge 002 -\ +\ \ Challenge #1 \ Write a script or one-liner to remove leading zeros from positive numbers. -: remove_leading_zeros ( str len -- str len ) - DUP 0> IF - BEGIN - DUP 1 > \ len > 0 - 2 PICK C@ '0' = \ starts with zero - AND WHILE - 1 /STRING \ remove character of string - REPEAT - THEN +: remove_leading_zeros ( str len -- str len ) + DUP 0> IF + BEGIN + DUP 1 > \ len > 0 + 2 PICK C@ '0' = \ starts with zero + AND WHILE + 1 /STRING \ remove character of string + REPEAT + THEN ; NEXT-ARG remove_leading_zeros TYPE CR BYE diff --git a/challenge-002/paulo-custodio/forth/ch-2.fs b/challenge-002/paulo-custodio/forth/ch-2.fs index 4105132d97..d9b16b3b11 100644 --- a/challenge-002/paulo-custodio/forth/ch-2.fs +++ b/challenge-002/paulo-custodio/forth/ch-2.fs @@ -1,30 +1,30 @@ #! /usr/bin/env gforth \ Challenge 002 -\ +\ \ Challenge #2 \ Write a script that can convert integers to and from a base35 -\ representation, using the characters 0-9 and A-Y. Dave Jacoby came up +\ representation, using the characters 0-9 and A-Y. Dave Jacoby came up \ with nice description about base35, in case you needed some background. \ get argument, parse -r 0 VALUE opt_r -: parse_args ( str len -- ) - NEXT-ARG - 2DUP s" -r" COMPARE 0= IF \ option -r - -1 TO opt_r \ reverse option - 2DROP NEXT-ARG \ read next argument - THEN +: parse_args ( str len -- ) + NEXT-ARG + 2DUP s" -r" COMPARE 0= IF \ option -r + -1 TO opt_r \ reverse option + 2DROP NEXT-ARG \ read next argument + THEN ; -: convertb35 ( str len -- ) - opt_r IF \ parse base 35 - 35 BASE ! S>NUMBER? DECIMAL 0= THROW DROP - . - ELSE - S>NUMBER? 0= THROW DROP - 35 BASE ! . DECIMAL - THEN +: convertb35 ( str len -- ) + opt_r IF \ parse base 35 + 35 BASE ! S>NUMBER? DECIMAL 0= THROW DROP + . + ELSE + S>NUMBER? 0= THROW DROP + 35 BASE ! . DECIMAL + THEN ; parse_args convertb35 CR BYE diff --git a/challenge-002/paulo-custodio/lua/ch-2.lua b/challenge-002/paulo-custodio/lua/ch-2.lua index df7d9a09f1..15a926434c 100644 --- a/challenge-002/paulo-custodio/lua/ch-2.lua +++ b/challenge-002/paulo-custodio/lua/ch-2.lua @@ -5,42 +5,42 @@ Challenge 002 Challenge #2 Write a script that can convert integers to and from a base35 -representation, using the characters 0-9 and A-Y. Dave Jacoby came up +representation, using the characters 0-9 and A-Y. Dave Jacoby came up with nice description about base35, in case you needed some background. --]] -- format a digit -function format_digit(n) - if n<10 then - return string.char(string.byte("0")+n) - else - return string.char(string.byte("A")+n-10) - end +function format_digit(n) + if n<10 then + return string.char(string.byte("0")+n) + else + return string.char(string.byte("A")+n-10) + end end -- format a number function format_number(n, base) - local negative, output = false, "" - if n<0 then negative, n = true, math.abs(n); end - repeat - local d = n % base - n = math.floor(n / base) - output = format_digit(d)..output - until n==0 - if negative then output = "-"..output; end - return output + local negative, output = false, "" + if n<0 then negative, n = true, math.abs(n); end + repeat + local d = n % base + n = math.floor(n / base) + output = format_digit(d)..output + until n==0 + if negative then output = "-"..output; end + return output end -- main -if arg[1] == "-r" then - opt_r, n = true, arg[2] -else - opt_r, n = false, arg[1] +if arg[1] == "-r" then + opt_r, n = true, arg[2] +else + opt_r, n = false, arg[1] end assert(n, "Usage: ch-2.lua [-r] nn") -if opt_r then - io.write(tonumber(n, 35), "\n") -else - io.write(format_number(tonumber(n), 35), "\n") +if opt_r then + io.write(tonumber(n, 35), "\n") +else + io.write(format_number(tonumber(n), 35), "\n") end diff --git a/challenge-002/paulo-custodio/perl/ch-2.pl b/challenge-002/paulo-custodio/perl/ch-2.pl index 37ae0b92a0..e669e5212b 100644 --- a/challenge-002/paulo-custodio/perl/ch-2.pl +++ b/challenge-002/paulo-custodio/perl/ch-2.pl @@ -4,7 +4,7 @@ # # Challenge #2 # Write a script that can convert integers to and from a base35 -# representation, using the characters 0-9 and A-Y. Dave Jacoby came up +# representation, using the characters 0-9 and A-Y. Dave Jacoby came up # with nice description about base35, in case you needed some background. use strict; diff --git a/challenge-002/paulo-custodio/python/ch-2.py b/challenge-002/paulo-custodio/python/ch-2.py index f889023920..2949876816 100644 --- a/challenge-002/paulo-custodio/python/ch-2.py +++ b/challenge-002/paulo-custodio/python/ch-2.py @@ -4,54 +4,54 @@ # # Challenge #2 # Write a script that can convert integers to and from a base35 -# representation, using the characters 0-9 and A-Y. Dave Jacoby came up +# representation, using the characters 0-9 and A-Y. Dave Jacoby came up # with nice description about base35, in case you needed some background. import sys def format_digit(n): - if n<10: - return chr(n+ord('0')) - else: - return chr(n+ord('A')-10) + if n<10: + return chr(n+ord('0')) + else: + return chr(n+ord('A')-10) def format_number(n, base): - negative = True if n<0 else False - n = abs(n) - output = "" - while True: - d = n % base - n = int(n / base) - output = format_digit(d) + output - if n == 0: break - if negative: - output = "-" + output - return output + negative = True if n<0 else False + n = abs(n) + output = "" + while True: + d = n % base + n = int(n / base) + output = format_digit(d) + output + if n == 0: break + if negative: + output = "-" + output + return output def scan_digit(str): - str = str.upper() - if str >= "0" and str <= "9": - return ord(str)-ord("0") - elif str >= "A" and str <= "Z": - return ord(str)-ord("A")+10 - else: - return -1 + str = str.upper() + if str >= "0" and str <= "9": + return ord(str)-ord("0") + elif str >= "A" and str <= "Z": + return ord(str)-ord("A")+10 + else: + return -1 def scan_number(str, base): - n, negative = 0, False - if str[0] == "-": - str = str[1:] - negative = True - while str != "": - d = scan_digit(str[0]) - str = str[1:] - assert d>=0 and d<base - n = n*base + d - if negative: - n = -n - return n + n, negative = 0, False + if str[0] == "-": + str = str[1:] + negative = True + while str != "": + d = scan_digit(str[0]) + str = str[1:] + assert d>=0 and d<base + n = n*base + d + if negative: + n = -n + return n if sys.argv[1] == "-r": - print(scan_number(sys.argv[2], 35)) + print(scan_number(sys.argv[2], 35)) else: - print(format_number(int(sys.argv[1]), 35)) + print(format_number(int(sys.argv[1]), 35)) diff --git a/challenge-002/paulo-custodio/test.pl b/challenge-002/paulo-custodio/test.pl index c5a13968ba..0f424abea5 100644 --- a/challenge-002/paulo-custodio/test.pl +++ b/challenge-002/paulo-custodio/test.pl @@ -13,18 +13,18 @@ run("fbc basic/ch-1.bas -o basic/ch-1"); for ([ "0" => "0"], ["000123" => "123"], - ["123" => "123"], + ["123" => "123"], ["-00123" => "-00123"], ["-123" => "-123"]) { - my($in, $out) = @$_; - - is capture( "$LUA lua/ch-1.lua $in"), "$out\n"; - is capture( "perl perl/ch-1.pl $in"), "$out\n"; - is capture( "gforth forth/ch-1.fs $in"), "$out\n"; - is capture("python python/ch-1.py $in"), "$out\n"; - is capture( "c/ch-1 $in"), "$out\n"; - is capture( "cpp/ch-1 $in"), "$out\n"; - is capture( "basic/ch-1 $in"), "$out\n"; + my($in, $out) = @$_; + + is capture( "$LUA lua/ch-1.lua $in"), "$out\n"; + is capture( "perl perl/ch-1.pl $in"), "$out\n"; + is capture( "gforth forth/ch-1.fs $in"), "$out\n"; + is capture("python python/ch-1.py $in"), "$out\n"; + is capture( "c/ch-1 $in"), "$out\n"; + is capture( "cpp/ch-1 $in"), "$out\n"; + is capture( "basic/ch-1 $in"), "$out\n"; } run("gcc c/ch-2.c -o c/ch-2"); @@ -35,22 +35,22 @@ for ([ "0" => "0"], [ "1" => "1"], [ "34" => "Y"], ["-35" => "-10"]) { - my($in, $out) = @$_; + my($in, $out) = @$_; - is capture( "$LUA lua/ch-2.lua $in "), "$out\n"; - is capture( "$LUA lua/ch-2.lua -r $out"), "$in\n"; - is capture( "perl perl/ch-2.pl $in "), "$out\n"; - is capture( "perl perl/ch-2.pl -r $out"), "$in\n"; - is capture( "gforth forth/ch-2.fs $in "), "$out\n"; - is capture( "gforth forth/ch-2.fs -r $out"), "$in\n"; - is capture( "python python/ch-2.py $in "), "$out\n"; - is capture( "python python/ch-2.py -r $out"), "$in\n"; - is capture( "c/ch-2 $in "), "$out\n"; - is capture( "c/ch-2 -r $out"), "$in\n"; - is capture( "cpp/ch-2 $in "), "$out\n"; - is capture( "cpp/ch-2 -r $out"), "$in\n"; -# is capture( "basic/ch-2 $in "), "$out\n"; -# is capture( "basic/ch-2 -r $out"), "$in\n"; + is capture( "$LUA lua/ch-2.lua $in "), "$out\n"; + is capture( "$LUA lua/ch-2.lua -r $out"), "$in\n"; + is capture( "perl perl/ch-2.pl $in "), "$out\n"; + is capture( "perl perl/ch-2.pl -r $out"), "$in\n"; + is capture( "gforth forth/ch-2.fs $in "), "$out\n"; + is capture( "gforth forth/ch-2.fs -r $out"), "$in\n"; + is capture( "python python/ch-2.py $in "), "$out\n"; + is capture( "python python/ch-2.py -r $out"), "$in\n"; + is capture( "c/ch-2 $in "), "$out\n"; + is capture( "c/ch-2 -r $out"), "$in\n"; + is capture( "cpp/ch-2 $in "), "$out\n"; + is capture( "cpp/ch-2 -r $out"), "$in\n"; +# is capture( "basic/ch-2 $in "), "$out\n"; +# is capture( "basic/ch-2 -r $out"), "$in\n"; } done_testing; @@ -64,5 +64,5 @@ sub capture { sub run { my($cmd) = @_; - ok 0==system($cmd), $cmd; + ok 0==system($cmd), $cmd; } |
