~ubuntu-branches/ubuntu/precise/libmath-calculus-expression-perl/precise

« back to all changes in this revision

Viewing changes to test.pl

  • Committer: Bazaar Package Importer
  • Author(s): Deepak Tripathi
  • Date: 2008-05-19 03:42:09 UTC
  • Revision ID: james.westby@ubuntu.com-20080519034209-wcsjhszqqgpd23zq
Tags: upstream-0.2.2.ds
ImportĀ upstreamĀ versionĀ 0.2.2.ds

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Before `make install' is performed this script should be runnable with
 
2
# `make test'. After `make install' it should work as `perl test.pl'
 
3
 
 
4
use Test;
 
5
BEGIN { plan tests => 8 };
 
6
 
 
7
use Math::Calculus::Expression;
 
8
ok(1);
 
9
 
 
10
my $exp = Math::Calculus::Expression->new;
 
11
ok(ref $exp);
 
12
 
 
13
ok($exp->setExpression('2*x + a'));
 
14
 
 
15
ok($exp->getExpression eq '2*x + a');
 
16
 
 
17
ok($exp->evaluate(x => 20, a => 2) == 42);
 
18
 
 
19
my $exp2 = $exp->clone;
 
20
ok($exp->sameRepresentation($exp2));
 
21
 
 
22
$exp->setExpression('2*3*x');
 
23
$exp->simplify;
 
24
ok($exp->getExpression eq '6*x');
 
25
 
 
26
$exp->setExpression('x^(2+1) + 6*5*x');
 
27
$exp->simplify;
 
28
ok($exp->getExpression eq 'x^3 + 30*x');