Permalink
Browse files

[t/spec] Single-op hyper hash tests.

git-svn-id: http://svn.pugscode.org/pugs@31025 c213334d-75ef-0310-aa23-eaa082d1ae64
  • Loading branch information...
colomon
colomon committed May 31, 2010
1 parent 1fdcc02 commit ec15c52d565cb06fefc90b6f2596e62234882d32
Showing with 47 additions and 5 deletions.
  1. +47 −5 S03-metaops/hyper.t
View
@@ -361,11 +361,11 @@ my @e;
is %r<b>, 8, 'hash - correct result form >>+<< (same keys)';
is %r<c>, 10, 'hash - correct result form >>+<< (same keys)';
- %r = %a >>+<< %d;
- is +%r, 3, 'hash - >>+<< result has right number of keys (union test)';
- is %r<a>, 6, 'hash - correct result form >>+<< (union test)';
- is %r<b>, 8, 'hash - correct result form >>+<< (union test)';
- is %r<c>, 3, 'hash - correct result form >>+<< (union test)';
+ %r = %a »+« %d;
+ is +%r, 3, 'hash - »+« result has right number of keys (union test)';
+ is %r<a>, 6, 'hash - correct result form »+« (union test)';
+ is %r<b>, 8, 'hash - correct result form »+« (union test)';
+ is %r<c>, 3, 'hash - correct result form »+« (union test)';
%r = %c >>+<< %b;
is +%r, 3, 'hash - >>+<< result has right number of keys (union test)';
@@ -412,6 +412,48 @@ my @e;
is %r<b>, 8, 'hash - correct result from <<+<<';
}
+{
+ my %a = a => 1, b => 2, c => 3;
+ my %r = -<<%a;
+ is +%r, 3, 'hash - -<< result has right number of keys';
+ is %r<a>, -1, 'hash - correct result from -<<';
+ is %r<b>, -2, 'hash - correct result from -<<';
+ is %r<c>, -3, 'hash - correct result from -<<';
+
+ %r = --<<%a;
+ is +%r, 3, 'hash - --<< result has right number of keys';
+ is %r<a>, 0, 'hash - correct result from --<<';
+ is %r<b>, 1, 'hash - correct result from --<<';
+ is %r<c>, 2, 'hash - correct result from --<<';
+ is +%a, 3, 'hash - --<< result has right number of keys';
+ is %a<a>, 0, 'hash - correct result from --<<';
+ is %a<b>, 1, 'hash - correct result from --<<';
+ is %a<c>, 2, 'hash - correct result from --<<';
+
+ %r = %a>>++;
+ is +%r, 3, 'hash - >>++ result has right number of keys';
+ is %r<a>, 0, 'hash - correct result from >>++';
+ is %r<b>, 1, 'hash - correct result from >>++';
+ is %r<c>, 2, 'hash - correct result from >>++';
+ is +%a, 3, 'hash - >>++ result has right number of keys';
+ is %a<a>, 1, 'hash - correct result from >>++';
+ is %a<b>, 2, 'hash - correct result from >>++';
+ is %a<c>, 3, 'hash - correct result from >>++';
+}
+
+{
+ our sub postfix:<!>($a) {
+ [*] 1..$a;
+ }
+
+ my %a = a => 1, b => 2, c => 3;
+ my %r = %a>>!;
+ is +%r, 3, 'hash - >>! result has right number of keys';
+ is %r<a>, 1, 'hash - correct result from >>!';
+ is %r<b>, 2, 'hash - correct result from >>!';
+ is %r<c>, 6, 'hash - correct result from >>!';
+}
+
# test non-UTF-8 input
#?pugs skip 'eval(Buf)'

0 comments on commit ec15c52

Please sign in to comment.