[svn:parrot] r42817 - trunk/t/library
fperrad at svn.parrot.org
fperrad at svn.parrot.org
Fri Nov 27 20:54:05 UTC 2009
Author: fperrad
Date: Fri Nov 27 20:54:02 2009
New Revision: 42817
URL: https://trac.parrot.org/parrot/changeset/42817
Log:
[t][cage] factorize load_bytecode 'lib.pbc'
Modified:
trunk/t/library/md5.t
trunk/t/library/protoobject.t
trunk/t/library/rand.t
trunk/t/library/uuid.t
Modified: trunk/t/library/md5.t
==============================================================================
--- trunk/t/library/md5.t Fri Nov 27 17:09:57 2009 (r42816)
+++ trunk/t/library/md5.t Fri Nov 27 20:54:02 2009 (r42817)
@@ -27,6 +27,8 @@
# Stress parrot using MD5 library
.sub main :main
+ load_bytecode "Digest/MD5.pbc"
+
.include 'test_more.pir'
plan(517)
@@ -39,8 +41,6 @@
.end
.sub test_miscellaneous_words
-
- load_bytecode "Digest/MD5.pbc"
$P0 = _md5sum ("Hello")
$S0 = _md5_hex($P0)
is($S0, '8b1a9953c4611296a827abf8c47804d7', 'md5 Hello')
@@ -56,18 +56,15 @@
$P0 = _md5sum ("Hello World!")
$S0 = _md5_hex($P0)
is($S0, 'ed076287532e86365e841e92bfc50d8c', 'md5 Hello World')
-
.end
.sub test_funny_chars
- load_bytecode "Digest/MD5.pbc"
$P0 = _md5sum ("\n\n\n\n\t")
$S0 = _md5_hex($P0)
is($S0, 'b66434493525523b4393ce0d1f2425d7', 'funny chars')
.end
.sub test_string_lengths
- load_bytecode "Digest/MD5.pbc"
$I0 = 0
$S10 = <<'OUTPUT'
@@ -201,7 +198,6 @@
.end
.sub test_really_long_string
- load_bytecode "Digest/MD5.pbc"
$S0 = "Hello Parrot World! "
repeat $S1, $S0, 50000
$P0 = _md5sum ($S1)
@@ -226,7 +222,6 @@
=cut
.sub test_recursive_md5_1
- load_bytecode "Digest/MD5.pbc"
.local string output
$S0 = "Hello World!"
$I0 = 0
@@ -464,7 +459,6 @@
=cut
.sub test_recursive_md5_2
- load_bytecode "Digest/MD5.pbc"
.local string output
.local pmc output_array
$S0 = "Hello World!"
Modified: trunk/t/library/protoobject.t
==============================================================================
--- trunk/t/library/protoobject.t Fri Nov 27 17:09:57 2009 (r42816)
+++ trunk/t/library/protoobject.t Fri Nov 27 20:54:02 2009 (r42817)
@@ -17,6 +17,8 @@
=cut
.sub main :main
+ load_bytecode 'Protoobject.pbc'
+
.include 'test_more.pir'
plan(13)
@@ -33,8 +35,6 @@
.sub test_basic_load
- load_bytecode 'Protoobject.pbc'
-
$P0 = get_hll_global 'Protomaker'
$S0 = typeof $P0
is($S0, 'Protomaker', 'basic load')
@@ -42,8 +42,6 @@
.sub test_type_of_protoobject
- load_bytecode 'Protoobject.pbc'
-
$P0 = get_hll_global 'Protomaker'
$P1 = newclass 'XYZ'
$P2 = $P0.'new_proto'($P1)
@@ -54,8 +52,6 @@
.sub test_type_of_ns_based_protoobject
- load_bytecode 'Protoobject.pbc'
-
$P0 = get_hll_global 'Protomaker'
$P1 = newclass ['Foo';'Bar1']
$P2 = $P0.'new_proto'($P1)
@@ -66,8 +62,6 @@
.sub test_protoobject_symbol_1
- load_bytecode 'Protoobject.pbc'
-
$P0 = get_hll_global 'Protomaker'
$P1 = newclass ['Foo';'Bar2']
$P2 = $P0.'new_proto'($P1)
@@ -79,8 +73,6 @@
.sub test_protoobject_symbol_2
- load_bytecode 'Protoobject.pbc'
-
$P0 = get_hll_global 'Protomaker'
$P1 = newclass 'Foo'
$P2 = $P0.'new_proto'($P1)
@@ -92,8 +84,6 @@
.sub test_protoobject_symbol_for_classes
- load_bytecode 'Protoobject.pbc'
-
$P0 = get_hll_global 'Protomaker'
$P1 = newclass 'Foo::Bar3'
$P2 = $P0.'new_proto'($P1)
@@ -105,8 +95,6 @@
.sub test_new_subclass_for_classes
- load_bytecode 'Protoobject.pbc'
-
$P0 = get_hll_global 'Protomaker'
$P1 = get_class 'Hash'
$P0.'new_subclass'($P1, 'Foo::Bar4')
@@ -122,8 +110,6 @@
.sub test_new_subclass_with_attrs
- load_bytecode 'Protoobject.pbc'
-
.local pmc protomaker, hashclass, attrs
protomaker = get_hll_global 'Protomaker'
hashclass = get_class 'Hash'
@@ -146,8 +132,6 @@
.sub test_method_new_on_protoobject
- load_bytecode 'Protoobject.pbc'
-
$P0 = newclass 'Foo1'
.local pmc protomaker
Modified: trunk/t/library/rand.t
==============================================================================
--- trunk/t/library/rand.t Fri Nov 27 17:09:57 2009 (r42816)
+++ trunk/t/library/rand.t Fri Nov 27 20:54:02 2009 (r42817)
@@ -17,15 +17,16 @@
=cut
.sub main :main
- .include 'test_more.pir'
+ load_bytecode 'Math/Rand.pbc'
+ .include 'test_more.pir'
plan(7)
+
test_rand_srand()
test_rand_max()
.end
.sub test_rand_srand
- load_bytecode 'Math/Rand.pbc'
.local pmc rand
rand = get_global [ 'Math'; 'Rand' ], 'rand'
.local pmc srand
@@ -46,7 +47,6 @@
.end
.sub test_rand_max
- load_bytecode 'Math/Rand.pbc'
.local pmc rand_max
rand_max = get_global [ 'Math'; 'Rand' ], 'RAND_MAX'
$I0 = rand_max()
Modified: trunk/t/library/uuid.t
==============================================================================
--- trunk/t/library/uuid.t Fri Nov 27 17:09:57 2009 (r42816)
+++ trunk/t/library/uuid.t Fri Nov 27 20:54:02 2009 (r42817)
@@ -17,6 +17,8 @@
=cut
.sub main :main
+ load_bytecode 'uuid.pbc'
+
.include 'test_more.pir'
plan(20)
@@ -33,7 +35,6 @@
.sub test_generate_1
- load_bytecode 'uuid.pbc'
$P0 = get_global ['uuid'], 'generate'
$P1 = $P0()
$S1 = typeof $P1
@@ -42,7 +43,6 @@
.sub test_generate_2
- load_bytecode 'uuid.pbc'
$P0 = get_global ['uuid'], 'generate'
$P1 = $P0()
like($P1, '<[0..9a..f]>**8\-<[0..9a..f]>**4\-<[0..9a..f]>**4\-<[0..9a..f]>**4\-<[0..9a..f]>**12', 'generate 2' )
@@ -50,7 +50,6 @@
.sub test_generate_random
- load_bytecode 'uuid.pbc'
$P0 = get_global ['uuid'], 'generate_random'
$P1 = $P0()
like($P1, '<[0..9a..f]>**8\-<[0..9a..f]>**4\-<[0..9a..f]>**4\-<[0..9a..f]>**4\-<[0..9a..f]>**12', 'generate random')
@@ -58,7 +57,6 @@
.sub test_generate_time
- load_bytecode 'uuid.pbc'
$P0 = get_global ['uuid'], 'generate_time'
$P1 = $P0()
like($P1, '<[0..9a..f]>**8\-<[0..9a..f]>**4\-<[0..9a..f]>**4\-<[0..9a..f]>**4\-<[0..9a..f]>**12', 'generate time')
@@ -66,7 +64,6 @@
.sub test_parse_1
- load_bytecode 'uuid.pbc'
$P0 = get_global ['uuid'], 'parse'
($I0, $P1) = $P0("84949cc5-4701-4a84-895b-354c584a981b")
is($I0, 0, 'parse 1')
@@ -76,7 +73,6 @@
.sub test_parse_2
- load_bytecode 'uuid.pbc'
$P0 = get_global ['uuid'], 'parse'
$I0 = $P0("84949cc5-4701-4a84-895b-354c584a981b")
is($I0, 0, 'parse 2')
@@ -104,7 +100,6 @@
.sub test_time
- load_bytecode 'uuid.pbc'
$P0 = get_global ['uuid'], 'parse'
($I0, $P1) = $P0("84949cc5-4701-4a84-895b-354c584a981b")
$I1 = $P1.'time'()
@@ -113,7 +108,6 @@
.sub test_type
- load_bytecode 'uuid.pbc'
$P0 = get_global ['uuid'], 'generate'
$P1 = $P0()
$I0 = $P1.'type'()
@@ -122,7 +116,6 @@
.sub test_variant
- load_bytecode 'uuid.pbc'
$P0 = get_global ['uuid'], 'generate'
$P1 = $P0()
$I0 = $P1.'variant'()
More information about the parrot-commits
mailing list