[svn:parrot] r47726 - trunk/t/pmc
NotFound at svn.parrot.org
NotFound at svn.parrot.org
Sun Jun 20 10:00:27 UTC 2010
Author: NotFound
Date: Sun Jun 20 10:00:26 2010
New Revision: 47726
URL: https://trac.parrot.org/parrot/changeset/47726
Log:
fix Float basic assignment tests and add one for get_repr
Modified:
trunk/t/pmc/float.t
Modified: trunk/t/pmc/float.t
==============================================================================
--- trunk/t/pmc/float.t Sun Jun 20 09:31:44 2010 (r47725)
+++ trunk/t/pmc/float.t Sun Jun 20 10:00:26 2010 (r47726)
@@ -1,5 +1,5 @@
#!./parrot
-# Copyright (C) 2001-2009, Parrot Foundation.
+# Copyright (C) 2001-20010, Parrot Foundation.
# $Id$
=head1 NAME
@@ -16,7 +16,7 @@
=cut
-.const int TESTS = 161
+.const int TESTS = 162
.const num PRECISION = 0.000001
.sub 'test' :main
@@ -89,32 +89,47 @@
.include 'fp_equality.pasm'
.sub 'basic_assignment'
- $P0 = new ['Float']
+ # Assignments can morph to other PMC type,
+ # use a new Float for each test to be sure we are testing
+ # the intended code.
+ $P0 = new ['Float']
$P0 = 0.001
is($P0, 0.001, 'basic float assignment 1', PRECISION)
+ $P0 = new ['Float']
$P0 = 12.5
is($P0, 12.5, 'basic assignment 2', PRECISION)
+ $P0 = new ['Float']
$P0 = 1000
is($P0, 1000.0, 'basic integer assignment', PRECISION)
+ $P0 = new ['Float']
$P0 = 'Twelve point five'
is($P0, 0.0, 'basic string assignment', PRECISION)
+ $P0 = new ['Float']
$P0 = 123.45
$I0 = $P0
is($I0, 123, 'rounding to integer')
+ $P0 = new ['Float']
$P0 = 123.45
$N0 = $P0
is($N0, 123.45, 'get_float_value', PRECISION)
+ $P0 = new ['Float']
$P0 = 123.45
$S0 = $P0
is($S0, '123.45', 'get string')
+ $P0 = new ['Float']
+ $P0 = 123.45
+ $S0 = get_repr $P0
+ is($S0, '123.45', 'get_repr')
+
+ $P0 = new ['Float']
$P0 = "12.49"
is($P0, 12.49, 'setting value from String', PRECISION)
.end
More information about the parrot-commits
mailing list