Repository: lucy-clownfish Updated Branches: refs/heads/master 22246a3ce -> 6b4b61d4d
Remove To_Bool methods Now that these methods aren't "virtual", they aren't very useful. Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/0bbfcfcb Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/0bbfcfcb Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/0bbfcfcb Branch: refs/heads/master Commit: 0bbfcfcb84390f1c696532534aa9e0e62fbf3ffa Parents: 22246a3 Author: Nick Wellnhofer <[email protected]> Authored: Fri Nov 20 15:12:14 2015 +0100 Committer: Nick Wellnhofer <[email protected]> Committed: Wed Jan 6 16:05:06 2016 +0100 ---------------------------------------------------------------------- runtime/core/Clownfish/Boolean.c | 5 ----- runtime/core/Clownfish/Boolean.cfh | 3 --- runtime/core/Clownfish/Num.c | 10 ---------- runtime/core/Clownfish/Num.cfh | 12 ------------ runtime/go/clownfish/boolean_test.go | 11 ----------- runtime/go/clownfish/float_test.go | 11 ----------- runtime/go/clownfish/integer_test.go | 11 ----------- runtime/perl/t/binding/031-num.t | 4 +--- 8 files changed, 1 insertion(+), 66 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/0bbfcfcb/runtime/core/Clownfish/Boolean.c ---------------------------------------------------------------------- diff --git a/runtime/core/Clownfish/Boolean.c b/runtime/core/Clownfish/Boolean.c index 434a9cd..55fcdbd 100644 --- a/runtime/core/Clownfish/Boolean.c +++ b/runtime/core/Clownfish/Boolean.c @@ -63,11 +63,6 @@ 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; http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/0bbfcfcb/runtime/core/Clownfish/Boolean.cfh ---------------------------------------------------------------------- diff --git a/runtime/core/Clownfish/Boolean.cfh b/runtime/core/Clownfish/Boolean.cfh index 272d6d6..19eacc7 100644 --- a/runtime/core/Clownfish/Boolean.cfh +++ b/runtime/core/Clownfish/Boolean.cfh @@ -53,9 +53,6 @@ public final class Clownfish::Boolean nickname Bool { public double To_F64(Boolean *self); - public bool - To_Bool(Boolean *self); - /* Returns self. */ public incremented Boolean* Clone(Boolean *self); http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/0bbfcfcb/runtime/core/Clownfish/Num.c ---------------------------------------------------------------------- diff --git a/runtime/core/Clownfish/Num.c b/runtime/core/Clownfish/Num.c index 991883f..3274b4a 100644 --- a/runtime/core/Clownfish/Num.c +++ b/runtime/core/Clownfish/Num.c @@ -111,11 +111,6 @@ Float_To_I64_IMP(Float *self) { return (int64_t)self->value; } -bool -Float_To_Bool_IMP(Float *self) { - return self->value != 0.0; -} - String* Float_To_String_IMP(Float *self) { return Str_newf("%f64", self->value); @@ -181,11 +176,6 @@ Int_To_F64_IMP(Integer *self) { return (double)self->value; } -bool -Int_To_Bool_IMP(Integer *self) { - return self->value != 0; -} - String* Int_To_String_IMP(Integer *self) { return Str_newf("%i64", self->value); http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/0bbfcfcb/runtime/core/Clownfish/Num.cfh ---------------------------------------------------------------------- diff --git a/runtime/core/Clownfish/Num.cfh b/runtime/core/Clownfish/Num.cfh index 6f127eb..dad03a5 100644 --- a/runtime/core/Clownfish/Num.cfh +++ b/runtime/core/Clownfish/Num.cfh @@ -40,12 +40,6 @@ public final class Clownfish::Float { public int64_t To_I64(Float *self); - /** Evaluate the number in a boolean context. Returns true if it is - * non-zero. - */ - public bool - To_Bool(Float *self); - public incremented String* To_String(Float *self); @@ -84,12 +78,6 @@ public final class Clownfish::Integer nickname Int { public double To_F64(Integer *self); - /** Evaluate the number in a boolean context. Returns true if it is - * non-zero. - */ - public bool - To_Bool(Integer *self); - public incremented String* To_String(Integer *self); http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/0bbfcfcb/runtime/go/clownfish/boolean_test.go ---------------------------------------------------------------------- diff --git a/runtime/go/clownfish/boolean_test.go b/runtime/go/clownfish/boolean_test.go index a1419cb..5078b28 100644 --- a/runtime/go/clownfish/boolean_test.go +++ b/runtime/go/clownfish/boolean_test.go @@ -51,17 +51,6 @@ func TestBooleanToI64(t *testing.T) { } } -func TestBooleanToBool(t *testing.T) { - myTrue := NewBoolean(true) - myFalse := NewBoolean(false) - if !myTrue.ToBool() { - t.Errorf("Expected true, got false") - } - if myFalse.ToBool() { - t.Errorf("Expected false, got true") - } -} - func TestBooleanToString(t *testing.T) { myTrue := NewBoolean(true) myFalse := NewBoolean(false) http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/0bbfcfcb/runtime/go/clownfish/float_test.go ---------------------------------------------------------------------- diff --git a/runtime/go/clownfish/float_test.go b/runtime/go/clownfish/float_test.go index 7c1f81a..b946f8f 100644 --- a/runtime/go/clownfish/float_test.go +++ b/runtime/go/clownfish/float_test.go @@ -32,17 +32,6 @@ func TestFloatToI64(t *testing.T) { } } -func TestFloatToBool(t *testing.T) { - num := NewFloat(0.1) - if got := num.ToBool(); !got { - t.Errorf("Expected true, got %v", got) - } - zero := NewFloat(0) - if got := zero.ToBool(); got { - t.Errorf("Expected false, got %v", got) - } -} - func TestFloatToString(t *testing.T) { num := NewFloat(2.5) if got := num.ToString(); got != "2.5" { http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/0bbfcfcb/runtime/go/clownfish/integer_test.go ---------------------------------------------------------------------- diff --git a/runtime/go/clownfish/integer_test.go b/runtime/go/clownfish/integer_test.go index 2d12fb4..7e946e9 100644 --- a/runtime/go/clownfish/integer_test.go +++ b/runtime/go/clownfish/integer_test.go @@ -32,17 +32,6 @@ func TestIntToF64(t *testing.T) { } } -func TestIntToBool(t *testing.T) { - fortyTwo := NewInteger(42) - if got := fortyTwo.ToBool(); !got { - t.Errorf("Expected true, got %v", got) - } - zero := NewInteger(0) - if got := zero.ToBool(); got { - t.Errorf("Expected false, got %v", got) - } -} - func TestIntToString(t *testing.T) { fortyTwo := NewInteger(42) if got := fortyTwo.ToString(); got != "42" { http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/0bbfcfcb/runtime/perl/t/binding/031-num.t ---------------------------------------------------------------------- diff --git a/runtime/perl/t/binding/031-num.t b/runtime/perl/t/binding/031-num.t index 8cc42d1..1a2e936 100644 --- a/runtime/perl/t/binding/031-num.t +++ b/runtime/perl/t/binding/031-num.t @@ -17,7 +17,7 @@ use strict; use warnings; use lib 'buildlib'; -use Test::More tests => 28; +use Test::More tests => 26; use Clownfish; use Clownfish::Boolean qw( $true_singleton $false_singleton ); @@ -27,7 +27,6 @@ isa_ok( $float, 'Clownfish::Float' ); is ( $float->get_value, 0.5, 'Float get_value' ); is ( $float->to_i64, 0, 'Float to_i64' ); -ok ( $float->to_bool, 'Float to_bool' ); is ( $float->to_string, '0.5', 'Float to_string' ); ok ( $float->equals($float), 'Float equals true' ); ok ( !$float->equals($neg_float), 'Float equals false' ); @@ -42,7 +41,6 @@ my $neg_int = Clownfish::Integer->new(-12345); isa_ok( $int, 'Clownfish::Integer' ); is ( $int->get_value, 12345, 'Integer get_value' ); -ok ( $int->to_bool, 'Integer to_bool' ); is ( $int->to_string, '12345', 'Integer to_string' ); ok ( $int->equals($int), 'Integer equals true' ); ok ( !$int->equals($neg_int), 'Integer equals false' );
