[svn:parrot] r47568 - in branches/gsoc_nfg: . t/op

darbelo at svn.parrot.org darbelo at svn.parrot.org
Sat Jun 12 17:36:31 UTC 2010


Author: darbelo
Date: Sat Jun 12 17:36:30 2010
New Revision: 47568
URL: https://trac.parrot.org/parrot/changeset/47568

Log:
Add NFG tests.

Added:
   branches/gsoc_nfg/t/op/string_nfg.t   (contents, props changed)
Modified:
   branches/gsoc_nfg/MANIFEST

Modified: branches/gsoc_nfg/MANIFEST
==============================================================================
--- branches/gsoc_nfg/MANIFEST	Sat Jun 12 16:48:04 2010	(r47567)
+++ branches/gsoc_nfg/MANIFEST	Sat Jun 12 17:36:30 2010	(r47568)
@@ -1,7 +1,7 @@
 # ex: set ro:
 # $Id$
 #
-# generated by tools/dev/mk_manifest_and_skip.pl Mon Jun  7 14:47:00 2010 UT
+# generated by tools/dev/mk_manifest_and_skip.pl Sat Jun 12 17:33:33 2010 UT
 #
 # See below for documentation on the format of this file.
 #
@@ -1826,6 +1826,7 @@
 t/op/string_cmp.t                                           [test]
 t/op/string_cs.t                                            [test]
 t/op/string_mem.t                                           [test]
+t/op/string_nfg.t                                           [test]
 t/op/stringu.t                                              [test]
 t/op/time.t                                                 [test]
 t/op/vivify.t                                               [test]

Added: branches/gsoc_nfg/t/op/string_nfg.t
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ branches/gsoc_nfg/t/op/string_nfg.t	Sat Jun 12 17:36:30 2010	(r47568)
@@ -0,0 +1,55 @@
+#!./parrot
+# Copyright (C) 2010, Parrot Foundation.
+# $Id$
+
+=head1 NAME
+
+t/op/string_nfg.t - test the NFG encoding and related string operations
+
+
+=head1 SYNOPSIS
+
+    % prove t/op/string_mem.t
+
+=head1 DESCRIPTION
+
+Tests the behaviour of nfg-encoded strings when subjecte to various
+string operations.
+
+=cut
+
+.include 'stringinfo.pasm'
+
+.const int TESTS = 3
+
+.sub _main :main
+    .include 'test_more.pir'
+
+    plan(TESTS)
+
+    without_graphemes()
+.end
+
+.sub without_graphemes
+
+    $S0 = "Hello, world"
+    $I0 = find_encoding 'nfg'
+    $S1 = trans_encoding $S0, $I0
+    $I1 = stringinfo $S0, .STRINGINFO_EXTRA
+    is($I1, 0, "Lazy table creation.")
+
+    $I0 = stringinfo $S0, .STRINGINFO_STRLEN
+    $I1 = stringinfo $S1, .STRINGINFO_STRLEN
+    is($I0, $I1, "Lenght is the same.")
+
+    $I2 =  stringinfo $S1, .STRINGINFO_BUFLEN
+    $I1 *= 4
+    is($I2, $I1, "buflen = 4 * strlen")
+
+.end
+
+# Local Variables:
+#   mode: pir
+#   fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4 ft=pir:


More information about the parrot-commits mailing list