Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added some basic tests #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions MANIFEST
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ docs/reference.html
docs/toc.html
eg/sample.pl
typemap
t/basic.t
1 change: 1 addition & 0 deletions Makefile.PL
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ unless ($^O eq "MSWin32" || $^O eq "cygwin") {

my %param = (
NAME => 'Win32::Console',
TEST_REQUIRES => { 'Test::More' => '0' },
VERSION_FROM => 'Console.pm',
);
$param{NO_META} = 1 if eval "$ExtUtils::MakeMaker::VERSION" >= 6.10_03;
Expand Down
33 changes: 33 additions & 0 deletions t/basic.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!perl

use Test::More;

use_ok("Win32::Console");

my $CONSOLE = Win32::Console->new();

ok $CONSOLE, "Constructor returns something";

# Not completely sure this is always true
ok $CONSOLE->Attr() > 0, "Attribute retrieved with success";

@cursor = $CONSOLE->Cursor();

is scalar(@cursor), 4, "Cursor returns coordinates, size and visibility";

ok $cursor[0] >= 0, "Cursor X is a positive integer";
ok $cursor[1] >= 0, "Cursor Y is a positive integer";

is $CONSOLE->FillChar("X", 80*25, 0, 0), 80*25, "Fill returns correct value";

@info = $CONSOLE->Info();

is scalar(@info), 11, "Info returns 11 elements";

ok $info[0] > 0, "Number of rows is positive";
ok $info[1] > 0, "Number of cols is positive";

ok $info[2] < $info[0], "row position in on screen";
ok $info[3] < $info[1], "col position is on screen";

done_testing();