#!/usr/bin/perl -w
use strict;
use Test::More qw(no_plan);

BEGIN { 
  use_ok('Colloseum'); 
}

`./init_db`;  # make sure database is in initial state.

ok( my ($greg) = Combatant->search( name => 'Greg Hart'),	'Greg is There');
ok( my ($marcus) = Combatant->search( name => 'Marcus Lorai'),       'Marcus is There');
ok( my ($alise) = Combatant->search( name => 'Alise Orde'),       'Alise is There');
ok( my ($mary) = Combatant->search( name => 'Mary Wilk'),       'Mary is There');

ok( $greg->name eq 'Greg Hart', 	'Greg\'s name is Greg Hart');
ok( $greg->bio->age == 17,			'Greg is 17');
ok( $greg->bio->height == 71,		'Greg is 71 inches tall');
ok( $greg->bio->weight == 216,		'Greg weighs 216 lbs');

#ok( my (@all_combatant)	= Combatant->retrieve_all,	'Got everything out of Combatant');
#ok( my (@all_biography)	= Biography->retrieve_all,      'Got everything out of Biography');
#ok( my (@all_stats)	= Stats->retrieve_all,          'Got everything out of Stats');
#ok( my (@all_combat_stats)	= Combat_Stats->retrieve_all,	'Got everything out of Combat_Stats');
#ok( my (@all_combat_records)	= Combat_Records->retrieve_all,	'Got everything out of Combat_Records');
#ok( my (@all_appearance)	= Appearance->retrieve_all,	'Got everything out of Appearance');
#ok( my (@all_hair_color)	= Hair_Color->retrieve_all,	'Got everything out of Hair_Color');
#ok( my (@all_eye_color)	= Combatant->retrieve_all,	'Got everything out of Eye_Color');
#ok( my (@all_skin_tone)	= Combatant->retrieve_all,	'Got everything out of Skin_Tone');
#ok( my (@all_gender)	= Gender->retrieve_all,		'Got everything out of Gender');

#ok( my ($greg_hdl) = Combatant->search(name => 'Greg Hart'),	'Greg no id ga arimasu');
#ok( my ($greg_app) = $greg_hdl->appearance,		'Greg no app ga arimasu');
#ok( my ($greg_hair) = Hair_Color->search(id => $greg_app->hair),	'Greg no kami ga aru');
#ok( my ($greg_color) = $greg_hair->color,	'Greg no kami no iro ga aru');
#print "Greg's hair is $greg_color\n";

ok( my ($alise_hdl) = Combatant->search(name => 'Alise Orde'),	'Alise no id');
ok( my ($alise_color) = $alise_hdl->appearance->hair->color,	'Alise no kami no iro');
print "Alise's hair is $alise_color\n";

#SELECT h.color FROM Combatant cmb, Appearance app, Hair_Color h WHERE cmb.id = 1 AND app.id = cmb.appearance AND h.id = app.hair;
#
#
#
#
#
#
#

##################################
########## JIM'S CODE ############
##################################
#ok( my ($albert) 
#    = Person->search( name => 'A. Einstein'),     'found a person Einstein');
#ok( $albert->name  eq 'A. Einstein',              '  and his name $al->name ');
#ok( $albert->phone eq '222-9999',                 '  and his phone $al->phone');
#
#ok( my ($faculty) 
#    = Status->search( name => 'faculty'),         'got a status $faculty');
#
#ok( my @al_regs = 
#    $albert->registrations( status => $faculty ), 'found courses Al is teaching');
#
#ok( scalar(@al_regs) == 1,                        '  which is exactly one course');
#my $al_reg = pop @al_regs;
#ok( $al_reg->course->name eq 'physics',           '  which is physics');
#ok( $al_reg->status->name eq 'faculty',           '  which he is teaching');
#
#my $newPerson = Person->create({ name=>"Santa", phone=>"000-0000"});
#ok($newPerson, 'created a new person');
#
#my @people = Person->retrieve_all;
#print " number of people : " . scalar @people . "\n";
#foreach my $person (@people){
#  print "  " . $person->name . "\n";
#}
#ok(scalar @people == 9,                           '9 people in database ');
