[svn:parrot] r47599 - in branches/gsoc_nfg: src/string t/op
darbelo at svn.parrot.org
darbelo at svn.parrot.org
Sun Jun 13 15:00:45 UTC 2010
Author: darbelo
Date: Sun Jun 13 15:00:44 2010
New Revision: 47599
URL: https://trac.parrot.org/parrot/changeset/47599
Log:
Add a failing test for NFG 'literals'.
Modified:
branches/gsoc_nfg/src/string/grapheme.h
branches/gsoc_nfg/t/op/string_nfg.t
Modified: branches/gsoc_nfg/src/string/grapheme.h
==============================================================================
--- branches/gsoc_nfg/src/string/grapheme.h Sun Jun 13 14:14:38 2010 (r47598)
+++ branches/gsoc_nfg/src/string/grapheme.h Sun Jun 13 15:00:44 2010 (r47599)
@@ -10,7 +10,7 @@
# include <unicode/uchar.h>
struct grapheme_t {
- UINTVAL len; /* Grapheme length in codepoints. */
+ INTVAL len; /* Grapheme length in codepoints. */
UChar32 *codepoints; /* UCS-4 codepoints that make up the grapheme */
UINTVAL hash;
};
@@ -20,8 +20,8 @@
# define MIN_TABLE_LENGTH 1
struct grapheme_table_t {
- UINTVAL size; /* Total table size, in graphemes. */
- UINTVAL used; /* Number of slots used from the table. */
+ INTVAL size; /* Total table size, in graphemes. */
+ INTVAL used; /* Number of slots used from the table. */
grapheme graphemes[MIN_TABLE_LENGTH];
/*
* Not really a static array. When we need a bigger table, we just allocate
Modified: branches/gsoc_nfg/t/op/string_nfg.t
==============================================================================
--- branches/gsoc_nfg/t/op/string_nfg.t Sun Jun 13 14:14:38 2010 (r47598)
+++ branches/gsoc_nfg/t/op/string_nfg.t Sun Jun 13 15:00:44 2010 (r47599)
@@ -13,22 +13,40 @@
=head1 DESCRIPTION
-Tests the behaviour of nfg-encoded strings when subjecte to various
+Tests the behaviour of nfg-encoded strings when subjected to various
string operations.
=cut
.include 'stringinfo.pasm'
-.const int TESTS = 6
+.const int TESTS = 8
.sub _main :main
.include 'test_more.pir'
plan(TESTS)
+ literals_and_transcoding()
transcode_without_graphemes()
transcode_with_graphemes()
+.end
+
+.sub literals_and_transcoding
+
+ $S0 = utf16:unicode:"\u006e\u0303\u0303\u0303\u0303\u00d1\u00d1"
+ $I0 = find_encoding 'nfg'
+ $S0 = trans_encoding $S0, $I0
+
+ $S1 = nfg:unicode:"\u006e\u0303\u0303\u0303\u0303\u00d1\u00d1"
+
+ $I0 = stringinfo $S0, .STRINGINFO_STRLEN
+ $I1 = stringinfo $S1, .STRINGINFO_STRLEN
+ is($I0, $I1, "Lenght is the same.")
+
+ $I0 = stringinfo $S0, .STRINGINFO_BUFUSED
+ $I1 = stringinfo $S1, .STRINGINFO_BUFUSED
+ is($I0, $I1, "Bufused is the same.")
.end
More information about the parrot-commits
mailing list