Tests for Class Go bindings.
Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/172822e6 Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/172822e6 Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/172822e6 Branch: refs/heads/master Commit: 172822e62b8ce190dd58f5889bdce2185e037df2 Parents: 9f8face Author: Marvin Humphrey <[email protected]> Authored: Fri Aug 7 17:52:43 2015 -0700 Committer: Marvin Humphrey <[email protected]> Committed: Sun Aug 9 19:00:35 2015 -0700 ---------------------------------------------------------------------- runtime/go/clownfish/class_test.go | 43 +++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/172822e6/runtime/go/clownfish/class_test.go ---------------------------------------------------------------------- diff --git a/runtime/go/clownfish/class_test.go b/runtime/go/clownfish/class_test.go new file mode 100644 index 0000000..81f3e2e --- /dev/null +++ b/runtime/go/clownfish/class_test.go @@ -0,0 +1,43 @@ +/* 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. + */ + +package clownfish + +import "testing" + +func TestClassGetName(t *testing.T) { + className := "Clownfish::Hash" + class := FetchClass(className) + if got := class.GetName(); got != className { + t.Errorf("Expected %s, got %s", className, got) + } +} + +func TestClassGetParent(t *testing.T) { + hashClass := FetchClass("Clownfish::Hash") + parent := hashClass.GetParent(); + if parentName := parent.GetName(); parentName != "Clownfish::Obj" { + t.Errorf("Expected Clownfish::Obj, got %s", parentName) + } +} + +func TestClassGetObjAllocSize(t *testing.T) { + intClass := FetchClass("Clownfish::Integer") + classClass := FetchClass("Clownfish::Class") + if intClass.GetObjAllocSize() >= classClass.GetObjAllocSize() { + t.Error("Unexpected result for GetObjAllocSize") + } +}
