You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by nw...@apache.org on 2015/07/11 14:52:38 UTC
[04/12] lucy-clownfish git commit: Separate boolean type from Num
Separate boolean type from Num
Rename BoolNum to Boolean which inherits directly from Obj.
Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/b584f58f
Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/b584f58f
Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/b584f58f
Branch: refs/heads/master
Commit: b584f58f172c2819e0b7e9b871224fcd0f082e55
Parents: 8d82f9a
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Thu Jul 9 13:22:31 2015 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Thu Jul 9 16:34:00 2015 +0200
----------------------------------------------------------------------
runtime/c/src/clownfish.c | 7 +-
runtime/core/Clownfish/Boolean.c | 85 ++++++++++++++++++++++
runtime/core/Clownfish/Boolean.cfh | 76 +++++++++++++++++++
runtime/core/Clownfish/Class.c | 4 +-
runtime/core/Clownfish/Num.c | 64 ----------------
runtime/core/Clownfish/Num.cfh | 58 ---------------
runtime/core/Clownfish/Test/TestBoolean.c | 93 ++++++++++++++++++++++++
runtime/core/Clownfish/Test/TestBoolean.cfh | 29 ++++++++
runtime/core/Clownfish/Test/TestHash.c | 2 +-
runtime/core/Clownfish/Test/TestNum.c | 36 +--------
runtime/core/Clownfish/Test/TestString.c | 2 +-
runtime/core/Clownfish/Test/TestVector.c | 1 +
runtime/go/ext/clownfish.c | 6 +-
runtime/perl/xs/XSBind.c | 7 +-
14 files changed, 300 insertions(+), 170 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/b584f58f/runtime/c/src/clownfish.c
----------------------------------------------------------------------
diff --git a/runtime/c/src/clownfish.c b/runtime/c/src/clownfish.c
index 6917ec2..e60eacc 100644
--- a/runtime/c/src/clownfish.c
+++ b/runtime/c/src/clownfish.c
@@ -30,6 +30,7 @@
#include "Clownfish/Obj.h"
#include "Clownfish/Class.h"
#include "Clownfish/Blob.h"
+#include "Clownfish/Boolean.h"
#include "Clownfish/ByteBuf.h"
#include "Clownfish/Err.h"
#include "Clownfish/Hash.h"
@@ -46,7 +47,7 @@ static CFISH_INLINE bool
SI_immortal(cfish_Class *klass) {
if (klass == CFISH_CLASS
|| klass == CFISH_METHOD
- || klass == CFISH_BOOLNUM
+ || klass == CFISH_BOOLEAN
){
return true;
}
@@ -334,9 +335,9 @@ Int64_To_Host_IMP(Integer64 *self) {
}
void*
-Bool_To_Host_IMP(BoolNum *self) {
+Bool_To_Host_IMP(Boolean *self) {
Bool_To_Host_t super_to_host
- = SUPER_METHOD_PTR(BOOLNUM, CFISH_Bool_To_Host);
+ = SUPER_METHOD_PTR(BOOLEAN, CFISH_Bool_To_Host);
return super_to_host(self);
}
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/b584f58f/runtime/core/Clownfish/Boolean.c
----------------------------------------------------------------------
diff --git a/runtime/core/Clownfish/Boolean.c b/runtime/core/Clownfish/Boolean.c
new file mode 100644
index 0000000..434a9cd
--- /dev/null
+++ b/runtime/core/Clownfish/Boolean.c
@@ -0,0 +1,85 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "charmony.h"
+
+#define C_CFISH_BOOLEAN
+#define CFISH_USE_SHORT_NAMES
+#include "Clownfish/Boolean.h"
+
+#include "Clownfish/Class.h"
+#include "Clownfish/String.h"
+
+Boolean *Bool_true_singleton;
+Boolean *Bool_false_singleton;
+
+void
+Bool_init_class() {
+ Bool_true_singleton = (Boolean*)Class_Make_Obj(BOOLEAN);
+ Bool_true_singleton->value = true;
+ Bool_true_singleton->string = Str_newf("true");
+ Bool_false_singleton = (Boolean*)Class_Make_Obj(BOOLEAN);
+ Bool_false_singleton->value = false;
+ Bool_false_singleton->string = Str_newf("false");
+}
+
+Boolean*
+Bool_singleton(bool value) {
+ return value ? CFISH_TRUE : CFISH_FALSE;
+}
+
+void
+Bool_Destroy_IMP(Boolean *self) {
+ if (self && self != CFISH_TRUE && self != CFISH_FALSE) {
+ SUPER_DESTROY(self, BOOLEAN);
+ }
+}
+
+bool
+Bool_Get_Value_IMP(Boolean *self) {
+ return self->value;
+}
+
+double
+Bool_To_F64_IMP(Boolean *self) {
+ return (double)self->value;
+}
+
+int64_t
+Bool_To_I64_IMP(Boolean *self) {
+ return self->value;
+}
+
+bool
+Bool_To_Bool_IMP(Boolean *self) {
+ return self->value;
+}
+
+Boolean*
+Bool_Clone_IMP(Boolean *self) {
+ return self;
+}
+
+String*
+Bool_To_String_IMP(Boolean *self) {
+ return (String*)INCREF(self->string);
+}
+
+bool
+Bool_Equals_IMP(Boolean *self, Obj *other) {
+ return self == (Boolean*)other;
+}
+
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/b584f58f/runtime/core/Clownfish/Boolean.cfh
----------------------------------------------------------------------
diff --git a/runtime/core/Clownfish/Boolean.cfh b/runtime/core/Clownfish/Boolean.cfh
new file mode 100644
index 0000000..e2454ce
--- /dev/null
+++ b/runtime/core/Clownfish/Boolean.cfh
@@ -0,0 +1,76 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+parcel Clownfish;
+
+/**
+ * Boolean type.
+ *
+ * There are only two singleton instances of this class: CFISH_TRUE and
+ * CFISH_FALSE.
+ */
+class Clownfish::Boolean nickname Bool {
+ bool value;
+ String *string;
+
+ inert Boolean *true_singleton;
+ inert Boolean *false_singleton;
+
+ inert void
+ init_class();
+
+ /** Return either CFISH_TRUE or CFISH_FALSE depending on the supplied
+ * value.
+ */
+ inert Boolean*
+ singleton(bool value);
+
+ public void
+ Destroy(Boolean *self);
+
+ void*
+ To_Host(Boolean *self);
+
+ bool
+ Get_Value(Boolean *self);
+
+ public int64_t
+ To_I64(Boolean *self);
+
+ public double
+ To_F64(Boolean *self);
+
+ public bool
+ To_Bool(Boolean *self);
+
+ /* Returns self. */
+ public incremented Boolean*
+ Clone(Boolean *self);
+
+ public bool
+ Equals(Boolean *self, Obj *other);
+
+ public incremented String*
+ To_String(Boolean *self);
+}
+
+__C__
+
+#define CFISH_TRUE cfish_Bool_true_singleton
+#define CFISH_FALSE cfish_Bool_false_singleton
+
+__END_C__
+
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/b584f58f/runtime/core/Clownfish/Class.c
----------------------------------------------------------------------
diff --git a/runtime/core/Clownfish/Class.c b/runtime/core/Clownfish/Class.c
index e1fb3b1..47ada81 100644
--- a/runtime/core/Clownfish/Class.c
+++ b/runtime/core/Clownfish/Class.c
@@ -27,12 +27,12 @@
#include "Clownfish/Class.h"
#include "Clownfish/String.h"
+#include "Clownfish/Boolean.h"
#include "Clownfish/CharBuf.h"
#include "Clownfish/Err.h"
#include "Clownfish/Hash.h"
#include "Clownfish/LockFreeRegistry.h"
#include "Clownfish/Method.h"
-#include "Clownfish/Num.h"
#include "Clownfish/Vector.h"
#include "Clownfish/Util/Atomic.h"
#include "Clownfish/Util/Memory.h"
@@ -145,7 +145,7 @@ Class_bootstrap(const ClassSpec *specs, size_t num_specs)
klass->flags = 0;
if (klass == CLASS
|| klass == METHOD
- || klass == BOOLNUM
+ || klass == BOOLEAN
|| klass == STRING
) {
klass->flags |= CFISH_fREFCOUNTSPECIAL;
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/b584f58f/runtime/core/Clownfish/Num.c
----------------------------------------------------------------------
diff --git a/runtime/core/Clownfish/Num.c b/runtime/core/Clownfish/Num.c
index d13c242..23edd1e 100644
--- a/runtime/core/Clownfish/Num.c
+++ b/runtime/core/Clownfish/Num.c
@@ -21,7 +21,6 @@
#define C_CFISH_INTEGER64
#define C_CFISH_FLOAT32
#define C_CFISH_FLOAT64
-#define C_CFISH_BOOLNUM
#define CFISH_USE_SHORT_NAMES
#include "charmony.h"
@@ -296,66 +295,3 @@ Int64_Equals_IMP(Integer64 *self, Obj *other) {
return true;
}
-/***************************************************************************/
-
-
-BoolNum *Bool_true_singleton;
-BoolNum *Bool_false_singleton;
-
-void
-Bool_init_class() {
- Bool_true_singleton = (BoolNum*)Class_Make_Obj(BOOLNUM);
- Bool_true_singleton->value = true;
- Bool_true_singleton->string = Str_newf("true");
- Bool_false_singleton = (BoolNum*)Class_Make_Obj(BOOLNUM);
- Bool_false_singleton->value = false;
- Bool_false_singleton->string = Str_newf("false");
-}
-
-BoolNum*
-Bool_singleton(bool value) {
- return value ? CFISH_TRUE : CFISH_FALSE;
-}
-
-void
-Bool_Destroy_IMP(BoolNum *self) {
- if (self && self != CFISH_TRUE && self != CFISH_FALSE) {
- SUPER_DESTROY(self, BOOLNUM);
- }
-}
-
-bool
-Bool_Get_Value_IMP(BoolNum *self) {
- return self->value;
-}
-
-double
-Bool_To_F64_IMP(BoolNum *self) {
- return (double)self->value;
-}
-
-int64_t
-Bool_To_I64_IMP(BoolNum *self) {
- return self->value;
-}
-
-bool
-Bool_To_Bool_IMP(BoolNum *self) {
- return self->value;
-}
-
-BoolNum*
-Bool_Clone_IMP(BoolNum *self) {
- return self;
-}
-
-String*
-Bool_To_String_IMP(BoolNum *self) {
- return (String*)INCREF(self->string);
-}
-
-bool
-Bool_Equals_IMP(BoolNum *self, Obj *other) {
- return self == (BoolNum*)other;
-}
-
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/b584f58f/runtime/core/Clownfish/Num.cfh
----------------------------------------------------------------------
diff --git a/runtime/core/Clownfish/Num.cfh b/runtime/core/Clownfish/Num.cfh
index 781048a..2c47bfd 100644
--- a/runtime/core/Clownfish/Num.cfh
+++ b/runtime/core/Clownfish/Num.cfh
@@ -227,61 +227,3 @@ final class Clownfish::Integer64 nickname Int64
}
-/**
- * Boolean type.
- *
- * There are only two singleton instances of this class: CFISH_TRUE and
- * CFISH_FALSE.
- */
-class Clownfish::BoolNum nickname Bool inherits Clownfish::IntNum {
- bool value;
- String *string;
-
- inert BoolNum *true_singleton;
- inert BoolNum *false_singleton;
-
- inert void
- init_class();
-
- /** Return either CFISH_TRUE or CFISH_FALSE depending on the supplied
- * value.
- */
- inert BoolNum*
- singleton(bool value);
-
- public void
- Destroy(BoolNum *self);
-
- void*
- To_Host(BoolNum *self);
-
- bool
- Get_Value(BoolNum *self);
-
- public int64_t
- To_I64(BoolNum *self);
-
- public double
- To_F64(BoolNum *self);
-
- public bool
- To_Bool(BoolNum *self);
-
- /* Returns self. */
- public incremented BoolNum*
- Clone(BoolNum *self);
-
- public bool
- Equals(BoolNum *self, Obj *other);
-
- public incremented String*
- To_String(BoolNum *self);
-}
-
-__C__
-
-#define CFISH_TRUE cfish_Bool_true_singleton
-#define CFISH_FALSE cfish_Bool_false_singleton
-
-__END_C__
-
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/b584f58f/runtime/core/Clownfish/Test/TestBoolean.c
----------------------------------------------------------------------
diff --git a/runtime/core/Clownfish/Test/TestBoolean.c b/runtime/core/Clownfish/Test/TestBoolean.c
new file mode 100644
index 0000000..e7db615
--- /dev/null
+++ b/runtime/core/Clownfish/Test/TestBoolean.c
@@ -0,0 +1,93 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define CFISH_USE_SHORT_NAMES
+#define TESTCFISH_USE_SHORT_NAMES
+
+#include "Clownfish/Test/TestBoolean.h"
+
+#include "Clownfish/String.h"
+#include "Clownfish/Boolean.h"
+#include "Clownfish/Test.h"
+#include "Clownfish/TestHarness/TestBatchRunner.h"
+#include "Clownfish/TestHarness/TestUtils.h"
+#include "Clownfish/Class.h"
+
+TestBoolean*
+TestBoolean_new() {
+ return (TestBoolean*)Class_Make_Obj(TESTBOOLEAN);
+}
+
+static void
+test_To_String(TestBatchRunner *runner) {
+ String *true_string = Bool_To_String(CFISH_TRUE);
+ String *false_string = Bool_To_String(CFISH_FALSE);
+
+ TEST_TRUE(runner, Str_Equals_Utf8(true_string, "true", 4),
+ "Bool_To_String [true]");
+ TEST_TRUE(runner, Str_Equals_Utf8(false_string, "false", 5),
+ "Bool_To_String [false]");
+
+ DECREF(false_string);
+ DECREF(true_string);
+}
+
+static void
+test_accessors(TestBatchRunner *runner) {
+ TEST_INT_EQ(runner, Bool_Get_Value(CFISH_TRUE), true,
+ "Bool_Get_Value [true]");
+ TEST_INT_EQ(runner, Bool_Get_Value(CFISH_FALSE), false,
+ "Bool_Get_Value [false]");
+ TEST_TRUE(runner, Bool_To_I64(CFISH_TRUE) == true,
+ "Bool_To_I64 [true]");
+ TEST_TRUE(runner, Bool_To_I64(CFISH_FALSE) == false,
+ "Bool_To_I64 [false]");
+ TEST_TRUE(runner, Bool_To_F64(CFISH_TRUE) == 1.0,
+ "Bool_To_F64 [true]");
+ TEST_TRUE(runner, Bool_To_F64(CFISH_FALSE) == 0.0,
+ "Bool_To_F64 [false]");
+}
+
+static void
+test_Equals_and_Compare_To(TestBatchRunner *runner) {
+ TEST_TRUE(runner, Bool_Equals(CFISH_TRUE, (Obj*)CFISH_TRUE),
+ "CFISH_TRUE Equals itself");
+ TEST_TRUE(runner, Bool_Equals(CFISH_FALSE, (Obj*)CFISH_FALSE),
+ "CFISH_FALSE Equals itself");
+ TEST_FALSE(runner, Bool_Equals(CFISH_FALSE, (Obj*)CFISH_TRUE),
+ "CFISH_FALSE not Equals CFISH_TRUE ");
+ TEST_FALSE(runner, Bool_Equals(CFISH_TRUE, (Obj*)CFISH_FALSE),
+ "CFISH_TRUE not Equals CFISH_FALSE ");
+ TEST_FALSE(runner, Bool_Equals(CFISH_TRUE, (Obj*)STRING),
+ "CFISH_TRUE not Equals random other object ");
+}
+
+static void
+test_Clone(TestBatchRunner *runner) {
+ TEST_TRUE(runner, Bool_Equals(CFISH_TRUE, (Obj*)Bool_Clone(CFISH_TRUE)),
+ "Boolean Clone");
+}
+
+void
+TestBoolean_Run_IMP(TestBoolean *self, TestBatchRunner *runner) {
+ TestBatchRunner_Plan(runner, (TestBatch*)self, 14);
+ test_To_String(runner);
+ test_accessors(runner);
+ test_Equals_and_Compare_To(runner);
+ test_Clone(runner);
+}
+
+
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/b584f58f/runtime/core/Clownfish/Test/TestBoolean.cfh
----------------------------------------------------------------------
diff --git a/runtime/core/Clownfish/Test/TestBoolean.cfh b/runtime/core/Clownfish/Test/TestBoolean.cfh
new file mode 100644
index 0000000..43702db
--- /dev/null
+++ b/runtime/core/Clownfish/Test/TestBoolean.cfh
@@ -0,0 +1,29 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+parcel TestClownfish;
+
+class Clownfish::Test::TestBoolean
+ inherits Clownfish::TestHarness::TestBatch {
+
+ inert incremented TestBoolean*
+ new();
+
+ void
+ Run(TestBoolean *self, TestBatchRunner *runner);
+}
+
+
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/b584f58f/runtime/core/Clownfish/Test/TestHash.c
----------------------------------------------------------------------
diff --git a/runtime/core/Clownfish/Test/TestHash.c b/runtime/core/Clownfish/Test/TestHash.c
index 0fecb00..e4075f1 100644
--- a/runtime/core/Clownfish/Test/TestHash.c
+++ b/runtime/core/Clownfish/Test/TestHash.c
@@ -23,8 +23,8 @@
#include "Clownfish/Test/TestHash.h"
#include "Clownfish/String.h"
+#include "Clownfish/Boolean.h"
#include "Clownfish/Hash.h"
-#include "Clownfish/Num.h"
#include "Clownfish/Test.h"
#include "Clownfish/TestHarness/TestBatchRunner.h"
#include "Clownfish/TestHarness/TestUtils.h"
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/b584f58f/runtime/core/Clownfish/Test/TestNum.c
----------------------------------------------------------------------
diff --git a/runtime/core/Clownfish/Test/TestNum.c b/runtime/core/Clownfish/Test/TestNum.c
index c30a169..1139987 100644
--- a/runtime/core/Clownfish/Test/TestNum.c
+++ b/runtime/core/Clownfish/Test/TestNum.c
@@ -41,8 +41,6 @@ test_To_String(TestBatchRunner *runner) {
String *f64_string = Float64_To_String(f64);
String *i32_string = Int32_To_String(i32);
String *i64_string = Int64_To_String(i64);
- String *true_string = Bool_To_String(CFISH_TRUE);
- String *false_string = Bool_To_String(CFISH_FALSE);
TEST_TRUE(runner, Str_Starts_With_Utf8(f32_string, "1.3", 3),
"Float32_To_String");
@@ -52,13 +50,7 @@ test_To_String(TestBatchRunner *runner) {
"Int32_To_String");
TEST_TRUE(runner, Str_Equals_Utf8(i64_string, "9223372036854775807", 19),
"Int64_To_String");
- TEST_TRUE(runner, Str_Equals_Utf8(true_string, "true", 4),
- "Bool_To_String [true]");
- TEST_TRUE(runner, Str_Equals_Utf8(false_string, "false", 5),
- "Bool_To_String [false]");
- DECREF(false_string);
- DECREF(true_string);
DECREF(i64_string);
DECREF(i32_string);
DECREF(f64_string);
@@ -113,19 +105,6 @@ test_accessors(TestBatchRunner *runner) {
TEST_TRUE(runner, Int32_To_F64(i32) == -1, "Int32_To_F64");
TEST_TRUE(runner, Int64_To_F64(i64) == -1, "Int64_To_F64");
- TEST_INT_EQ(runner, Bool_Get_Value(CFISH_TRUE), true,
- "Bool_Get_Value [true]");
- TEST_INT_EQ(runner, Bool_Get_Value(CFISH_FALSE), false,
- "Bool_Get_Value [false]");
- TEST_TRUE(runner, Bool_To_I64(CFISH_TRUE) == true,
- "Bool_To_I64 [true]");
- TEST_TRUE(runner, Bool_To_I64(CFISH_FALSE) == false,
- "Bool_To_I64 [false]");
- TEST_TRUE(runner, Bool_To_F64(CFISH_TRUE) == 1.0,
- "Bool_To_F64 [true]");
- TEST_TRUE(runner, Bool_To_F64(CFISH_FALSE) == 0.0,
- "Bool_To_F64 [false]");
-
DECREF(i64);
DECREF(i32);
DECREF(f64);
@@ -192,17 +171,6 @@ test_Equals_and_Compare_To(TestBatchRunner *runner) {
TEST_TRUE(runner, Int64_Compare_To(i64, (Obj*)i64_copy) == 0,
"Integer64 comparison to same number");
- TEST_TRUE(runner, Bool_Equals(CFISH_TRUE, (Obj*)CFISH_TRUE),
- "CFISH_TRUE Equals itself");
- TEST_TRUE(runner, Bool_Equals(CFISH_FALSE, (Obj*)CFISH_FALSE),
- "CFISH_FALSE Equals itself");
- TEST_FALSE(runner, Bool_Equals(CFISH_FALSE, (Obj*)CFISH_TRUE),
- "CFISH_FALSE not Equals CFISH_TRUE ");
- TEST_FALSE(runner, Bool_Equals(CFISH_TRUE, (Obj*)CFISH_FALSE),
- "CFISH_TRUE not Equals CFISH_FALSE ");
- TEST_FALSE(runner, Bool_Equals(CFISH_TRUE, (Obj*)STRING),
- "CFISH_TRUE not Equals random other object ");
-
DECREF(i64_copy);
DECREF(i64);
DECREF(i32);
@@ -228,8 +196,6 @@ test_Clone(TestBatchRunner *runner) {
"Integer32 Clone");
TEST_TRUE(runner, Int64_Equals(i64, (Obj*)i64_dupe),
"Integer64 Clone");
- TEST_TRUE(runner, Bool_Equals(CFISH_TRUE, (Obj*)Bool_Clone(CFISH_TRUE)),
- "BoolNum Clone");
DECREF(i64_dupe);
DECREF(i32_dupe);
DECREF(f64_dupe);
@@ -274,7 +240,7 @@ test_Mimic(TestBatchRunner *runner) {
void
TestNum_Run_IMP(TestNum *self, TestBatchRunner *runner) {
- TestBatchRunner_Plan(runner, (TestBatch*)self, 53);
+ TestBatchRunner_Plan(runner, (TestBatch*)self, 39);
test_To_String(runner);
test_accessors(runner);
test_Equals_and_Compare_To(runner);
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/b584f58f/runtime/core/Clownfish/Test/TestString.c
----------------------------------------------------------------------
diff --git a/runtime/core/Clownfish/Test/TestString.c b/runtime/core/Clownfish/Test/TestString.c
index f35bc8a..eff029b 100644
--- a/runtime/core/Clownfish/Test/TestString.c
+++ b/runtime/core/Clownfish/Test/TestString.c
@@ -23,8 +23,8 @@
#include "Clownfish/Test/TestString.h"
#include "Clownfish/String.h"
+#include "Clownfish/Boolean.h"
#include "Clownfish/CharBuf.h"
-#include "Clownfish/Num.h"
#include "Clownfish/Test.h"
#include "Clownfish/TestHarness/TestBatchRunner.h"
#include "Clownfish/TestHarness/TestUtils.h"
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/b584f58f/runtime/core/Clownfish/Test/TestVector.c
----------------------------------------------------------------------
diff --git a/runtime/core/Clownfish/Test/TestVector.c b/runtime/core/Clownfish/Test/TestVector.c
index de21ee2..79d8958 100644
--- a/runtime/core/Clownfish/Test/TestVector.c
+++ b/runtime/core/Clownfish/Test/TestVector.c
@@ -24,6 +24,7 @@
#include "Clownfish/Test/TestVector.h"
#include "Clownfish/String.h"
+#include "Clownfish/Boolean.h"
#include "Clownfish/Err.h"
#include "Clownfish/Num.h"
#include "Clownfish/Test.h"
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/b584f58f/runtime/go/ext/clownfish.c
----------------------------------------------------------------------
diff --git a/runtime/go/ext/clownfish.c b/runtime/go/ext/clownfish.c
index affe772..0a2fa5d 100644
--- a/runtime/go/ext/clownfish.c
+++ b/runtime/go/ext/clownfish.c
@@ -45,7 +45,7 @@ static CFISH_INLINE bool
SI_immortal(cfish_Class *klass) {
if (klass == CFISH_CLASS
|| klass == CFISH_METHOD
- || klass == CFISH_BOOLNUM
+ || klass == CFISH_BOOLEAN
){
return true;
}
@@ -305,9 +305,9 @@ Int64_To_Host_IMP(Integer64 *self) {
}
void*
-Bool_To_Host_IMP(BoolNum *self) {
+Bool_To_Host_IMP(Boolean *self) {
Bool_To_Host_t super_to_host
- = SUPER_METHOD_PTR(BOOLNUM, CFISH_Bool_To_Host);
+ = SUPER_METHOD_PTR(BOOLEAN, CFISH_Bool_To_Host);
return super_to_host(self);
}
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/b584f58f/runtime/perl/xs/XSBind.c
----------------------------------------------------------------------
diff --git a/runtime/perl/xs/XSBind.c b/runtime/perl/xs/XSBind.c
index 20cd377..f500f34 100644
--- a/runtime/perl/xs/XSBind.c
+++ b/runtime/perl/xs/XSBind.c
@@ -23,10 +23,11 @@
#define C_CFISH_FLOAT64
#define C_CFISH_INTEGER32
#define C_CFISH_INTEGER64
-#define C_CFISH_BOOLNUM
+#define C_CFISH_BOOLEAN
#define NEED_newRV_noinc
#include "charmony.h"
#include "XSBind.h"
+#include "Clownfish/Boolean.h"
#include "Clownfish/CharBuf.h"
#include "Clownfish/HashIterator.h"
#include "Clownfish/Method.h"
@@ -495,7 +496,7 @@ static CFISH_INLINE bool
SI_immortal(cfish_Class *klass) {
if (klass == CFISH_CLASS
|| klass == CFISH_METHOD
- || klass == CFISH_BOOLNUM
+ || klass == CFISH_BOOLEAN
){
return true;
}
@@ -1040,7 +1041,7 @@ CFISH_Int64_To_Host_IMP(cfish_Integer64 *self) {
}
void*
-CFISH_Bool_To_Host_IMP(cfish_BoolNum *self) {
+CFISH_Bool_To_Host_IMP(cfish_Boolean *self) {
dTHX;
return newSViv((IV)self->value);
}