From ba187dbfa54d03ff59b384f445143291796da242 Mon Sep 17 00:00:00 2001 From: "Jonathan \"Duke\" Leto" Date: Tue, 17 Aug 2010 01:30:52 -0700 Subject: [PATCH] Add a Fibonacci test using placeholder variables in PL/Perl6 --- t/sql/plperl6.sql | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/t/sql/plperl6.sql b/t/sql/plperl6.sql index 918cd77..d61bbc7 100644 --- a/t/sql/plperl6.sql +++ b/t/sql/plperl6.sql @@ -15,7 +15,7 @@ BEGIN; \i plparrot.sql -- Plan the tests. -SELECT plan(14); +SELECT plan(15); CREATE OR REPLACE FUNCTION test_void_plperl6() RETURNS void LANGUAGE plperl6 AS $$ { Nil } @@ -54,6 +54,12 @@ CREATE OR REPLACE FUNCTION test_named_fibonacci_plperl6(integer) RETURNS int LAN } $$; +CREATE OR REPLACE FUNCTION test_placeholder_fibonacci_plperl6(integer) RETURNS int LANGUAGE plperl6 AS $$ +{ + [+] (1, 1, *+* ... $^limit) +} +$$; + CREATE OR REPLACE FUNCTION test_input_2_placeholders(integer, integer) RETURNS int LANGUAGE plperl6 AS $$ { return $^a * $^b - $^b; @@ -94,6 +100,7 @@ select is(test_named_pointy(10,20,30), 6000, 'Pointy blocks with named parameter select is(test_named_fibonacci_plperl6(100),232,'Calculate the sum of all Fibonacci numbers <= 100 (named variable in signature)'); select is(test_fibonacci_plperl6(100),232,'Calculate the sum of all Fibonacci numbers <= 100'); +select is(test_placeholder_fibonacci_plperl6(100),232,'Calculate the sum of all Fibonacci numbers <= 100 (placeholder variable)'); SELECT language_is_trusted( 'plperl6', 'PL/Perl6 should be trusted' );