Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
awit-perl-toolkit
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
awit-frameworks
awit-perl-toolkit
Commits
ab0b1b40
Commit
ab0b1b40
authored
Sep 12, 2016
by
Nigel Kukard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revamped unit tests
parent
0d4b3fc6
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
239 additions
and
16 deletions
+239
-16
t/booleanize.t
t/booleanize.t
+59
-0
t/ishash.t
t/ishash.t
+53
-0
t/isindent.t
t/isindent.t
+47
-0
t/isnumber.t
t/isnumber.t
+35
-16
t/isvariable.t
t/isvariable.t
+45
-0
No files found.
t/booleanize.t
0 → 100644
View file @
ab0b1b40
# Test harness for booleanize
# Copyright (C) 2014-2016, AllWorldIT
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
use
Test::
More
;
use
strict
;
use
warnings
;
use
AWITPT::
Util
;
is
(
booleanize
(
0
),
0
,"
Booleanize of 0 should return 0
");
is
(
booleanize
("
0
"),
0
,"
Booleanize of '0' should return 0
");
is
(
booleanize
("
00
"),
0
,"
Booleanize of '00' should return 0
");
is
(
booleanize
("
-1
"),
0
,"
Booleanize of '-1' should return 0
");
is
(
booleanize
("
-0
"),
0
,"
Booleanize of '-0' should return 0
");
is
(
booleanize
("
a
"),
0
,"
Booleanize of 'a' should return 0
");
is
(
booleanize
("
0a
"),
0
,"
Booleanize of 'a' should return 0
");
is
(
booleanize
("
a0
"),
0
,"
Booleanize of 'a' should return 0
");
is
(
booleanize
("
TruE
"),
1
,"
Booleanize of 'TruE' should return 1
");
is
(
booleanize
("
oN
"),
1
,"
Booleanize of 'oN' should return 1
");
is
(
booleanize
("
SeT
"),
1
,"
Booleanize of 'SeT' should return 1
");
is
(
booleanize
("
EnAblED
"),
1
,"
Booleanize of 'EnAblED' should return 1
");
is
(
booleanize
(
1
),
1
,"
Booleanize of 1 should return 1
");
is
(
booleanize
("
1
"),
1
,"
Booleanize of '1' should return 1
");
done_testing
();
t/ishash.t
0 → 100644
View file @
ab0b1b40
# Test harness for isNumber
# Copyright (C) 2014, AllWorldIT
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
use
Test::
More
;
use
strict
;
use
warnings
;
use
AWITPT::
Util
;
use
AWITPT::
Object
;
my
$hash
=
{
'
makeHash
'
=>
1
};
my
$scalar
=
1
;
my
$object
=
AWITPT::
Object
->
new
();
is
(
isHash
(
$hash
),
1
,"
Make sure a HASH returns 1
");
is
(
isHash
(
$scalar
),
0
,"
Make sure a scalar returns 0
");
is
(
isHash
(
0
),
0
,"
Make sure 0 returns 0
");
is
(
isHash
("
0
"),
0
,"
Make sure '0' returns 0
");
is
(
isHash
("
a
"),
0
,"
Make sure 'a' returns 0
");
is
(
isHash
(
$object
),
0
,"
Make sure OBJECT returns 0
");
done_testing
();
t/isindent.t
0 → 100644
View file @
ab0b1b40
# Test harness for indentExpand
# Copyright (C) 2014-2016, AllWorldIT
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
use
Test::
More
;
use
strict
;
use
warnings
;
use
AWITPT::
Util
;
is
(
indentExpand
('
',
4
),'
',"
Check that indentExpand 4 spaces returns 4 spaces
");
is
(
indentExpand
('
',
4
),'
',"
Check that indentExpand 4 x 4 spaces returns 16 spaces
");
is
(
indentExpand
('
',
2
),'
',"
Check that indentExpand 2 spaces returns 2 spaces
");
is
(
indentExpand
('
',
2
),'
',"
Check that indentExpand 2 x 2 spaces returns 4 spaces
");
is
(
indentExpand
('
',
1
),'
',"
Check that indentExpand 1 spaces returns 1 space
");
is
(
indentExpand
('
',
1
),'
',"
Check that indentExpand 1 x 5 spaces returns 1 space
");
is
(
indentExpand
('
',
3
),'
',"
Check that indentExpand 3 returns 3 spaces
");
is
(
indentExpand
('
',
3
),'
',"
Check that indentExpand 3 x 3 spaces returns 9 spaces
");
done_testing
();
t/isnumber.t
View file @
ab0b1b40
# Test harness for isNumber
# Copyright (C) 2014, AllWorldIT
# Copyright (C) 2014
-2016
, AllWorldIT
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
...
...
@@ -17,31 +17,50 @@
use
Test::
More
;
use
strict
;
use
warnings
;
use
AWITPT::
Util
;
use
AWITPT::
Object
;
my
$hash
=
{
'
makeHash
'
=>
1
};
my
$object
=
AWITPT::
Object
->
new
();
is
(
isNumber
(
0
),
undef
,"
Check 0 returns undef
");
is
(
isNumber
("
0
"),
undef
,"
Check '0' returns undef
");
is
(
isNumber
(
0
),
undef
);
is
(
isNumber
(
0
,
ISNUMBER_ALLOW_ZERO
),
0
);
is
(
isNumber
("
000
",
ISNUMBER_ALLOW_ZERO
),
0
);
is
(
isNumber
("
-0
",
ISNUMBER_ALLOW_ZERO
),
0
);
is
(
isNumber
(
0
,
ISNUMBER_ALLOW_ZERO
),
0
,"
Check 0 returns 0 when using ISNUMBER_ALLOW_ZERO
");
is
(
isNumber
("
000
",
ISNUMBER_ALLOW_ZERO
),
0
,"
Check 000 returns 0 when using ISNUMBER_ALLOW_ZEOR
");
is
(
isNumber
("
-0
",
ISNUMBER_ALLOW_ZERO
),
0
,"
Check -0 returns 0 when using ISNUMBER_ALLOW_ZERO
");
is
(
isNumber
(
-
1
),
undef
);
is
(
isNumber
(
-
1
,
ISNUMBER_ALLOW_NEGATIVE
),
-
1
);
is
(
isNumber
("
-1
",
ISNUMBER_ALLOW_NEGATIVE
),
-
1
);
is
(
isNumber
("
-01
",
ISNUMBER_ALLOW_NEGATIVE
),
-
1
);
is
(
isNumber
(
-
1
),
undef
,"
Check -1 returns undef
");
is
(
isNumber
("
-1
"),
undef
,"
Check '-1' returns undef
");
is
(
isNumber
(
-
1
,
ISNUMBER_ALLOW_NEGATIVE
),
-
1
,"
Check -1 returns -1 when using ISNUMBER_ALLOW_NEGATIVE
");
is
(
isNumber
("
-1
",
ISNUMBER_ALLOW_NEGATIVE
),
-
1
,"
Check '-1' returns -1 when using ISNUMBER_ALLOW_NEGATIVE
");
is
(
isNumber
("
-01
",
ISNUMBER_ALLOW_NEGATIVE
),
-
1
,"
Check '-01' returns -1 when using ISNUMBER_ALLOW_NEGATIVE
");
is
(
isNumber
(
1
),
1
);
is
(
isNumber
(
1
),
1
,"
Check 1 returns 1
");
is
(
isNumber
("
1
"),
1
,"
Check '1' returns 1
");
is
(
isNumber
("
0001
"),
1
);
is
(
isNumber
("
0001
"),
1
,"
Check '0001' returns 1
");
is
(
isNumber
("
a
"),
undef
,"
Check 'a' returns undef
");
is
(
isNumber
("
0a
"),
undef
,"
Check '0a' returns undef
");
is
(
isNumber
("
a0
"),
undef
,"
Check 'a0' returns undef
");
is
(
isNumber
("
-a0
"),
undef
,"
Check '-a0' returns undef
");
is
(
isNumber
("
-0a
"),
undef
,"
Check '-0a' returns undef
");
is
(
isNumber
(
$hash
),
undef
,"
Check HASH returns undef
");
is
(
isNumber
(
$object
),
undef
,"
Check OBJECT returns undef
");
is
(
isNumber
("
a
"),
undef
);
is
(
isNumber
("
0a
"),
undef
);
is
(
isNumber
("
a0
"),
undef
);
is
(
isNumber
("
-a0
"),
undef
);
is
(
isNumber
("
-0a
"),
undef
);
done_testing
();
t/isvariable.t
0 → 100644
View file @
ab0b1b40
# Test harness for isVariable
# Copyright (C) 2014-2016, AllWorldIT
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
use
Test::
More
;
use
strict
;
use
warnings
;
use
AWITPT::
Util
;
my
$hashtable
=
{
'
makeHash
'
=>
1
};
my
$scalar
=
1
;
is
(
isVariable
(
$hashtable
),
0
,"
Check that a hash returns 0
");
is
(
isVariable
(
$scalar
),
1
,"
Check that a variable returns 1
");
is
(
isVariable
(
1
),
1
,"
Check that 1 returns 1
");
is
(
isVariable
(
undef
),
undef
,"
Check that a undef returns undef
");
done_testing
();
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment