[SCM] Lisaac compiler branch, master, updated. 85b14c143d111a6010abc6ae75df4edbbd0f652e
Jeremy Cowgar
jeremy at cowgar.com
Thu Mar 26 16:30:06 UTC 2009
The following commit has been merged in the master branch:
commit 85b14c143d111a6010abc6ae75df4edbbd0f652e
Author: Jeremy Cowgar <jeremy at cowgar.com>
Date: Thu Mar 26 12:27:58 2009 -0400
* Added more tests to BOOLEAN_TEST.
* Fixed syntax bug in CHARACTER.to_string_in.
* Added test suite for CHARACTER that currently only tests
for the to_string_in bug.
* Removed a bunch of empty lines at the bottom of TRUE.li.
diff --git a/lib/base/character.li b/lib/base/character.li
index 47b7629..e74bc06 100644
--- a/lib/base/character.li
+++ b/lib/base/character.li
@@ -374,7 +374,7 @@ Section Public
// can save memory because no other STRING is allocated
// for the job.
(
- str.append_character str;
+ str.append_character Self;
);
- to_hexadecimal:STRING <-
diff --git a/lib/base/true.li b/lib/base/true.li
index 5046693..e80eed2 100644
--- a/lib/base/true.li
+++ b/lib/base/true.li
@@ -115,10 +115,3 @@ Section Public
- to_integer:INTEGER <- 1;
- to_character:CHARACTER <- '1';
-
-
-
-
-
-
-
diff --git a/tests/boolean_test.li b/tests/boolean_test.li
index 03fadfa..690f6ec 100644
--- a/tests/boolean_test.li
+++ b/tests/boolean_test.li
@@ -40,7 +40,7 @@ Section Public
- run <-
( + pass:BOOLEAN;
- + tmp:ABSTRACT_STRING;
+ + tmp:STRING;
UNIT_TEST.suite "BOOLEAN";
@@ -184,7 +184,18 @@ Section Public
UNIT_TEST.test "& #2" boolean (TRUE & FALSE) equals FALSE;
UNIT_TEST.test "& #3" boolean (FALSE & TRUE) equals FALSE;
UNIT_TEST.test "& #4" boolean (FALSE & FALSE) equals FALSE;
- // TODO: What does ^, ->, ->> => do on BOOLEAN values?
+ UNIT_TEST.test "^ #1" boolean (TRUE ^ TRUE) equals FALSE;
+ UNIT_TEST.test "^ #2" boolean (TRUE ^ FALSE) equals TRUE;
+ UNIT_TEST.test "^ #3" boolean (FALSE ^ TRUE) equals TRUE;
+ UNIT_TEST.test "^ #4" boolean (FALSE ^ FALSE) equals FALSE;
+ UNIT_TEST.test "-> #1" boolean (TRUE -> TRUE) equals TRUE;
+ UNIT_TEST.test "-> #2" boolean (TRUE -> FALSE) equals FALSE;
+ UNIT_TEST.test "-> #3" boolean (FALSE -> TRUE) equals TRUE;
+ UNIT_TEST.test "-> #4" boolean (FALSE -> FALSE) equals TRUE;
+ UNIT_TEST.test "->> #1" boolean (TRUE ->> { TRUE }) equals TRUE;
+ UNIT_TEST.test "->> #2" boolean (TRUE ->> { FALSE }) equals FALSE;
+ UNIT_TEST.test "->> #3" boolean (FALSE ->> { TRUE }) equals TRUE;
+ UNIT_TEST.test "->> #4" boolean (FALSE ->> { FALSE }) equals TRUE;
UNIT_TEST.test "! #1" boolean (! TRUE) equals FALSE;
UNIT_TEST.test "! #2" boolean (! FALSE) equals TRUE;
@@ -201,11 +212,10 @@ Section Public
UNIT_TEST.test "to_character #1" character (TRUE.to_character) equals '1';
UNIT_TEST.test "to_character #2" character (FALSE.to_character) equals '0';
- tmp := "TMP";
+ tmp := STRING.create 5;
TRUE.append_in tmp;
- UNIT_TEST.test "TRUE.append_in" string tmp equals "TMP1";
+ UNIT_TEST.test "TRUE.append_in" string tmp equals "1";
FALSE.append_in tmp;
- UNIT_TEST.test "FALSE.append_in" string tmp equals "TMP10";
+ UNIT_TEST.test "FALSE.append_in" string tmp equals "10";
);
-
diff --git a/tests/lib_tests.li b/tests/character_test.li
similarity index 82%
copy from tests/lib_tests.li
copy to tests/character_test.li
index 4180e2c..c21318f 100644
--- a/tests/lib_tests.li
+++ b/tests/character_test.li
@@ -21,20 +21,25 @@
Section Header
- + name := LIB_TESTS;
+ + name := CHARACTER_TEST;
- copyright := "2009 Jeremy Cowgar";
- - comment := "Unit testing of the Lisaac library.";
+ - comment := "Test suite for CHARACTER.";
Section Public
- - main <-
+ - run <-
(
- UNIT_TEST.init;
+ +tmp:STRING;
- ABSTRACT_STRING_TEST.run;
- BOOLEAN_TEST.run;
+ tmp := STRING.create 5;
- UNIT_TEST.test_results
+ UNIT_TEST.suite "CHARACTER";
+
+ UNIT_TEST.section "Conversions";
+ UNIT_TEST.test "to_string #1" string ('a'.to_string) equals "a";
+
+ 'A'.to_string_in tmp;
+ UNIT_TEST.test "append_in #1" string tmp equals "A";
);
diff --git a/tests/lib_tests.li b/tests/lib_tests.li
index 4180e2c..4c2bffe 100644
--- a/tests/lib_tests.li
+++ b/tests/lib_tests.li
@@ -35,6 +35,7 @@ Section Public
ABSTRACT_STRING_TEST.run;
BOOLEAN_TEST.run;
+ CHARACTER_TEST.run;
UNIT_TEST.test_results
);
--
Lisaac compiler
More information about the Lisaac-commits
mailing list