#!/usr/bin/perl -Tw

use AN::Tut::Tools 0.0.001;
my $an=AN::Tut::Tools->new();

# Make sure that $parent matches $an.
my $parent=$an->Say->_parent();
is($an, $parent, "Internal 'parent' method returns same blessed reference as is in \$an.");

# Make sure that all methods are available.
my @methods=("_parent", "math");
can_ok("AN::Tut::Tools::Say", @methods);

# First, I need something to talk about, so I will use this:
my $num1=10;
my $num2=12;
my $result=$an->Math->add($num1, $num2);

# Now, this module has only one method that takes arguments, but it can receive
# those arguments is several ways. This tests them.
is(
	$an->Say->math("add", $num1, $num2, $result), 						# Got
	"I added: [$num1] and: [$num2] and got: [$result].", 					# Expect
	"math(); Test default language processing using the default language, array-type call."	# Message
);
is(
	$an->Say->math("add", $num1, $num2, $result, "fr"), 					# Got
	"J'ai additionné: [$num1] et: [$num2] et la somme est: [$result].", 			# Expect
	"math(); Test processing, specifying French, array-type call."				# Message
);
is(
	$an->Say->math({task=>"add", num1=>$num1, num2=>$num2, result=>$result, lang=>"fr"}), 	# Got
	"J'ai additionné: [$num1] et: [$num2] et la somme est: [$result].", 			# Expect
	"math(); Test processing, specifying French, hash-type call."				# Message
);
