Adding log.gd

This commit is contained in:
Dan Baker 2024-05-02 09:36:31 +01:00
parent eb32d6614e
commit 4522259397
547 changed files with 46844 additions and 0 deletions

View file

@ -0,0 +1,29 @@
# GdUnit generated TestSuite
class_name AnyArgumentMatcherTest
extends GdUnitTestSuite
# TestSuite generated from
const __source = 'res://addons/gdUnit4/src/matchers/AnyArgumentMatcher.gd'
func test_is_match():
var matcher := AnyArgumentMatcher.new()
assert_bool(matcher.is_match(null)).is_true()
assert_bool(matcher.is_match("")).is_true()
assert_bool(matcher.is_match("abc")).is_true()
assert_bool(matcher.is_match(true)).is_true()
assert_bool(matcher.is_match(false)).is_true()
assert_bool(matcher.is_match(0)).is_true()
assert_bool(matcher.is_match(100010)).is_true()
assert_bool(matcher.is_match(1.2)).is_true()
assert_bool(matcher.is_match(RefCounted.new())).is_true()
assert_bool(matcher.is_match(auto_free(Node.new()))).is_true()
func test_any():
assert_object(any()).is_instanceof(AnyArgumentMatcher)
func test_to_string() -> void:
assert_str(str(any())).is_equal("any()")

View file

@ -0,0 +1,228 @@
# GdUnit generated TestSuite
class_name AnyBuildInTypeArgumentMatcherTest
extends GdUnitTestSuite
# TestSuite generated from
const __source = 'res://addons/gdUnit4/src/matchers/AnyBuildInTypeArgumentMatcher.gd'
func test_is_match_bool() -> void:
assert_object(any_bool()).is_instanceof(AnyBuildInTypeArgumentMatcher)
var matcher := any_bool()
assert_bool(matcher.is_match(true)).is_true()
assert_bool(matcher.is_match(false)).is_true()
assert_bool(matcher.is_match(null)).is_false()
assert_bool(matcher.is_match("")).is_false()
assert_bool(matcher.is_match(0)).is_false()
assert_bool(matcher.is_match(0.2)).is_false()
assert_bool(matcher.is_match(auto_free(Node.new()))).is_false()
func test_is_match_int() -> void:
assert_object(any_int()).is_instanceof(AnyBuildInTypeArgumentMatcher)
var matcher := any_int()
assert_bool(matcher.is_match(0)).is_true()
assert_bool(matcher.is_match(1000)).is_true()
assert_bool(matcher.is_match(null)).is_false()
assert_bool(matcher.is_match("")).is_false()
assert_bool(matcher.is_match([])).is_false()
assert_bool(matcher.is_match(0.2)).is_false()
assert_bool(matcher.is_match(auto_free(Node.new()))).is_false()
func test_is_match_float() -> void:
assert_object(any_float()).is_instanceof(AnyBuildInTypeArgumentMatcher)
var matcher := any_float()
assert_bool(matcher.is_match(.0)).is_true()
assert_bool(matcher.is_match(0.0)).is_true()
assert_bool(matcher.is_match(null)).is_false()
assert_bool(matcher.is_match("")).is_false()
assert_bool(matcher.is_match([])).is_false()
assert_bool(matcher.is_match(1000)).is_false()
assert_bool(matcher.is_match(auto_free(Node.new()))).is_false()
func test_is_match_string() -> void:
assert_object(any_string()).is_instanceof(AnyBuildInTypeArgumentMatcher)
var matcher := any_string()
assert_bool(matcher.is_match("")).is_true()
assert_bool(matcher.is_match("abc")).is_true()
assert_bool(matcher.is_match(0)).is_false()
assert_bool(matcher.is_match(1000)).is_false()
assert_bool(matcher.is_match(null)).is_false()
assert_bool(matcher.is_match([])).is_false()
assert_bool(matcher.is_match(0.2)).is_false()
assert_bool(matcher.is_match(auto_free(Node.new()))).is_false()
func test_is_match_color() -> void:
assert_object(any_color()).is_instanceof(AnyBuildInTypeArgumentMatcher)
var matcher := any_color()
assert_bool(matcher.is_match("")).is_false()
assert_bool(matcher.is_match("abc")).is_false()
assert_bool(matcher.is_match(0)).is_false()
assert_bool(matcher.is_match(1000)).is_false()
assert_bool(matcher.is_match(null)).is_false()
assert_bool(matcher.is_match(Color.ALICE_BLUE)).is_true()
assert_bool(matcher.is_match(Color.RED)).is_true()
func test_is_match_vector() -> void:
assert_object(any_vector()).is_instanceof(AnyBuildInTypeArgumentMatcher)
var matcher := any_vector()
assert_bool(matcher.is_match(Vector2.ONE)).is_true()
assert_bool(matcher.is_match(Vector2i.ONE)).is_true()
assert_bool(matcher.is_match(Vector3.ONE)).is_true()
assert_bool(matcher.is_match(Vector3i.ONE)).is_true()
assert_bool(matcher.is_match(Vector4.ONE)).is_true()
assert_bool(matcher.is_match(Vector4i.ONE)).is_true()
assert_bool(matcher.is_match("")).is_false()
assert_bool(matcher.is_match("abc")).is_false()
assert_bool(matcher.is_match(0)).is_false()
assert_bool(matcher.is_match(1000)).is_false()
assert_bool(matcher.is_match(null)).is_false()
func test_is_match_vector2() -> void:
assert_object(any_vector2()).is_instanceof(AnyBuildInTypeArgumentMatcher)
var matcher := any_vector2()
assert_bool(matcher.is_match(Vector2.ONE)).is_true()
assert_bool(matcher.is_match("")).is_false()
assert_bool(matcher.is_match("abc")).is_false()
assert_bool(matcher.is_match(0)).is_false()
assert_bool(matcher.is_match(1000)).is_false()
assert_bool(matcher.is_match(null)).is_false()
assert_bool(matcher.is_match(Vector2i.ONE)).is_false()
assert_bool(matcher.is_match(Vector3.ONE)).is_false()
assert_bool(matcher.is_match(Vector3i.ONE)).is_false()
assert_bool(matcher.is_match(Vector4.ONE)).is_false()
assert_bool(matcher.is_match(Vector4i.ONE)).is_false()
func test_is_match_vector2i() -> void:
assert_object(any_vector2i()).is_instanceof(AnyBuildInTypeArgumentMatcher)
var matcher := any_vector2i()
assert_bool(matcher.is_match(Vector2i.ONE)).is_true()
assert_bool(matcher.is_match("")).is_false()
assert_bool(matcher.is_match("abc")).is_false()
assert_bool(matcher.is_match(0)).is_false()
assert_bool(matcher.is_match(1000)).is_false()
assert_bool(matcher.is_match(null)).is_false()
assert_bool(matcher.is_match(Vector2.ONE)).is_false()
assert_bool(matcher.is_match(Vector3.ONE)).is_false()
assert_bool(matcher.is_match(Vector3i.ONE)).is_false()
assert_bool(matcher.is_match(Vector4.ONE)).is_false()
assert_bool(matcher.is_match(Vector4i.ONE)).is_false()
func test_is_match_vector3() -> void:
assert_object(any_vector3()).is_instanceof(AnyBuildInTypeArgumentMatcher)
var matcher := any_vector3()
assert_bool(matcher.is_match(Vector3.ONE)).is_true()
assert_bool(matcher.is_match("")).is_false()
assert_bool(matcher.is_match("abc")).is_false()
assert_bool(matcher.is_match(0)).is_false()
assert_bool(matcher.is_match(1000)).is_false()
assert_bool(matcher.is_match(null)).is_false()
assert_bool(matcher.is_match(Vector2.ONE)).is_false()
assert_bool(matcher.is_match(Vector2i.ONE)).is_false()
assert_bool(matcher.is_match(Vector3i.ONE)).is_false()
assert_bool(matcher.is_match(Vector4.ONE)).is_false()
assert_bool(matcher.is_match(Vector4i.ONE)).is_false()
func test_is_match_vector3i() -> void:
assert_object(any_vector3i()).is_instanceof(AnyBuildInTypeArgumentMatcher)
var matcher := any_vector3i()
assert_bool(matcher.is_match(Vector3i.ONE)).is_true()
assert_bool(matcher.is_match("")).is_false()
assert_bool(matcher.is_match("abc")).is_false()
assert_bool(matcher.is_match(0)).is_false()
assert_bool(matcher.is_match(1000)).is_false()
assert_bool(matcher.is_match(null)).is_false()
assert_bool(matcher.is_match(Vector2.ONE)).is_false()
assert_bool(matcher.is_match(Vector2i.ONE)).is_false()
assert_bool(matcher.is_match(Vector3.ONE)).is_false()
assert_bool(matcher.is_match(Vector4.ONE)).is_false()
assert_bool(matcher.is_match(Vector4i.ONE)).is_false()
func test_is_match_vector4() -> void:
assert_object(any_vector4()).is_instanceof(AnyBuildInTypeArgumentMatcher)
var matcher := any_vector4()
assert_bool(matcher.is_match(Vector4.ONE)).is_true()
assert_bool(matcher.is_match("")).is_false()
assert_bool(matcher.is_match("abc")).is_false()
assert_bool(matcher.is_match(0)).is_false()
assert_bool(matcher.is_match(1000)).is_false()
assert_bool(matcher.is_match(null)).is_false()
assert_bool(matcher.is_match(Vector2.ONE)).is_false()
assert_bool(matcher.is_match(Vector2i.ONE)).is_false()
assert_bool(matcher.is_match(Vector3.ONE)).is_false()
assert_bool(matcher.is_match(Vector3i.ONE)).is_false()
assert_bool(matcher.is_match(Vector4i.ONE)).is_false()
func test_is_match_vector4i() -> void:
assert_object(any_vector4i()).is_instanceof(AnyBuildInTypeArgumentMatcher)
var matcher := any_vector4i()
assert_bool(matcher.is_match(Vector4i.ONE)).is_true()
assert_bool(matcher.is_match("")).is_false()
assert_bool(matcher.is_match("abc")).is_false()
assert_bool(matcher.is_match(0)).is_false()
assert_bool(matcher.is_match(1000)).is_false()
assert_bool(matcher.is_match(null)).is_false()
assert_bool(matcher.is_match(Vector2.ONE)).is_false()
assert_bool(matcher.is_match(Vector2i.ONE)).is_false()
assert_bool(matcher.is_match(Vector3.ONE)).is_false()
assert_bool(matcher.is_match(Vector3i.ONE)).is_false()
assert_bool(matcher.is_match(Vector4.ONE)).is_false()
func test_to_string() -> void:
assert_str(str(any_bool())).is_equal("any_bool()")
assert_str(str(any_int())).is_equal("any_int()")
assert_str(str(any_float())).is_equal("any_float()")
assert_str(str(any_string())).is_equal("any_string()")
assert_str(str(any_color())).is_equal("any_color()")
assert_str(str(any_vector())).is_equal("any_vector()")
assert_str(str(any_vector2())).is_equal("any_vector2()")
assert_str(str(any_vector2i())).is_equal("any_vector2i()")
assert_str(str(any_vector3())).is_equal("any_vector3()")
assert_str(str(any_vector3i())).is_equal("any_vector3i()")
assert_str(str(any_vector4())).is_equal("any_vector4()")
assert_str(str(any_vector4i())).is_equal("any_vector4i()")
assert_str(str(any_rect2())).is_equal("any_rect2()")
assert_str(str(any_plane())).is_equal("any_plane()")
assert_str(str(any_quat())).is_equal("any_quat()")
assert_str(str(any_quat())).is_equal("any_quat()")
assert_str(str(any_basis())).is_equal("any_basis()")
assert_str(str(any_transform_2d())).is_equal("any_transform_2d()")
assert_str(str(any_transform_3d())).is_equal("any_transform_3d()")
assert_str(str(any_node_path())).is_equal("any_node_path()")
assert_str(str(any_rid())).is_equal("any_rid()")
assert_str(str(any_object())).is_equal("any_object()")
assert_str(str(any_dictionary())).is_equal("any_dictionary()")
assert_str(str(any_array())).is_equal("any_array()")
assert_str(str(any_packed_byte_array())).is_equal("any_packed_byte_array()")
assert_str(str(any_packed_int32_array())).is_equal("any_packed_int32_array()")
assert_str(str(any_packed_int64_array())).is_equal("any_packed_int64_array()")
assert_str(str(any_packed_float32_array())).is_equal("any_packed_float32_array()")
assert_str(str(any_packed_float64_array())).is_equal("any_packed_float64_array()")
assert_str(str(any_packed_string_array())).is_equal("any_packed_string_array()")
assert_str(str(any_packed_vector2_array())).is_equal("any_packed_vector2_array()")
assert_str(str(any_packed_vector3_array())).is_equal("any_packed_vector3_array()")
assert_str(str(any_packed_color_array())).is_equal("any_packed_color_array()")

View file

@ -0,0 +1,43 @@
# GdUnit generated TestSuite
class_name AnyClazzArgumentMatcherTest
extends GdUnitTestSuite
# TestSuite generated from
const __source = 'res://addons/gdUnit4/src/matchers/AnyClazzArgumentMatcher.gd'
func test_is_match_reference():
var matcher := AnyClazzArgumentMatcher.new(RefCounted)
assert_bool(matcher.is_match(Resource.new())).is_true()
assert_bool(matcher.is_match(RefCounted.new())).is_true()
assert_bool(matcher.is_match(auto_free(Node.new()))).is_false()
assert_bool(matcher.is_match(null)).is_false()
assert_bool(matcher.is_match(0)).is_false()
assert_bool(matcher.is_match(false)).is_false()
assert_bool(matcher.is_match(true)).is_false()
func test_is_match_node():
var matcher := AnyClazzArgumentMatcher.new(Node)
assert_bool(matcher.is_match(auto_free(Node.new()))).is_true()
assert_bool(matcher.is_match(auto_free(AnimationPlayer.new()))).is_true()
assert_bool(matcher.is_match(auto_free(Timer.new()))).is_true()
assert_bool(matcher.is_match(Resource.new())).is_false()
assert_bool(matcher.is_match(RefCounted.new())).is_false()
assert_bool(matcher.is_match(null)).is_false()
assert_bool(matcher.is_match(0)).is_false()
assert_bool(matcher.is_match(false)).is_false()
assert_bool(matcher.is_match(true)).is_false()
func test_any_class():
assert_object(any_class(Node)).is_instanceof(AnyClazzArgumentMatcher)
func test_to_string() -> void:
assert_str(str(any_class(Node))).is_equal("any_class(<Node>)")
assert_str(str(any_class(Object))).is_equal("any_class(<Object>)")
assert_str(str(any_class(RefCounted))).is_equal("any_class(<RefCounted>)")
assert_str(str(any_class(GdObjects))).is_equal("any_class(<GdObjects>)")

View file

@ -0,0 +1,36 @@
# GdUnit generated TestSuite
class_name ChainedArgumentMatcherTest
extends GdUnitTestSuite
# TestSuite generated from
const __source = 'res://addons/gdUnit4/src/matchers/ChainedArgumentMatcher.gd'
func test_is_match_one_arg():
var matchers = [
EqualsArgumentMatcher.new("foo")
]
var matcher := ChainedArgumentMatcher.new(matchers)
assert_bool(matcher.is_match(["foo"])).is_true()
assert_bool(matcher.is_match(["bar"])).is_false()
func test_is_match_two_arg():
var matchers = [
EqualsArgumentMatcher.new("foo"),
EqualsArgumentMatcher.new("value1")
]
var matcher := ChainedArgumentMatcher.new(matchers)
assert_bool(matcher.is_match(["foo", "value1"])).is_true()
assert_bool(matcher.is_match(["foo", "value2"])).is_false()
assert_bool(matcher.is_match(["bar", "value1"])).is_false()
func test_is_match_different_arg_and_matcher():
var matchers = [
EqualsArgumentMatcher.new("foo")
]
var matcher := ChainedArgumentMatcher.new(matchers)
assert_bool(matcher.is_match(["foo", "value"])).is_false()

View file

@ -0,0 +1,26 @@
extends GdUnitTestSuite
class CustomArgumentMatcher extends GdUnitArgumentMatcher:
var _peek :int
func _init(peek :int):
_peek = peek
func is_match(value) -> bool:
return value > _peek
func test_custom_matcher():
var mocked_test_class : CustomArgumentMatcherTestClass = mock(CustomArgumentMatcherTestClass)
mocked_test_class.set_value(1000)
mocked_test_class.set_value(1001)
mocked_test_class.set_value(1002)
mocked_test_class.set_value(2002)
# counts 1001, 1002, 2002 = 3 times
verify(mocked_test_class, 3).set_value(CustomArgumentMatcher.new(1000))
# counts 2002 = 1 times
verify(mocked_test_class, 1).set_value(CustomArgumentMatcher.new(2000))

View file

@ -0,0 +1,16 @@
# GdUnit generated TestSuite
class_name GdUnitArgumentMatchersTest
extends GdUnitTestSuite
# TestSuite generated from
const __source = 'res://addons/gdUnit4/src/matchers/GdUnitArgumentMatchers.gd'
func test_arguments_to_chained_matcher():
var matcher := GdUnitArgumentMatchers.to_matcher(["foo", false, 1])
assert_object(matcher).is_instanceof(ChainedArgumentMatcher)
assert_bool(matcher.is_match(["foo", false, 1])).is_true()
assert_bool(matcher.is_match(["foo", false, 2])).is_false()
assert_bool(matcher.is_match(["foo", true, 1])).is_false()
assert_bool(matcher.is_match(["bar", false, 1])).is_false()

View file

@ -0,0 +1,8 @@
class_name CustomArgumentMatcherTestClass
extends RefCounted
var _value :int
func set_value(value :int):
_value = value