Adding log.gd
This commit is contained in:
parent
eb32d6614e
commit
4522259397
547 changed files with 46844 additions and 0 deletions
84
addons/gdUnit4/test/mocker/resources/AdvancedTestClass.gd
Normal file
84
addons/gdUnit4/test/mocker/resources/AdvancedTestClass.gd
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
# this class used to mock testing with inner classes and default arguments in functions
|
||||
class_name AdvancedTestClass
|
||||
extends Resource
|
||||
|
||||
class SoundData:
|
||||
@warning_ignore("unused_private_class_variable")
|
||||
var _sample :String
|
||||
@warning_ignore("unused_private_class_variable")
|
||||
var _randomnes :float
|
||||
|
||||
class AtmosphereData:
|
||||
enum {
|
||||
WATER,
|
||||
AIR,
|
||||
SMOKY,
|
||||
}
|
||||
var _toxigen :float
|
||||
var _type :int
|
||||
|
||||
func _init(type := AIR, toxigen := 0.0):
|
||||
_type = type
|
||||
_toxigen = toxigen
|
||||
# some comment, and an row staring with an space to simmulate invalid formatting
|
||||
|
||||
|
||||
# seter func with default values
|
||||
func set_data(type := AIR, toxigen := 0.0) :
|
||||
_type = type
|
||||
_toxigen = toxigen
|
||||
|
||||
static func to_atmosphere(_value :Dictionary) -> AtmosphereData:
|
||||
return null
|
||||
|
||||
class Area4D extends Resource:
|
||||
|
||||
const SOUND := 1
|
||||
const ATMOSPHERE := 2
|
||||
var _meta := Dictionary()
|
||||
|
||||
func _init(_x :int, atmospere :AtmosphereData = null):
|
||||
_meta[ATMOSPHERE] = atmospere
|
||||
|
||||
func get_sound() -> SoundData:
|
||||
# sounds are optional
|
||||
if _meta.has(SOUND):
|
||||
return _meta[SOUND] as SoundData
|
||||
return null
|
||||
|
||||
func get_atmoshere() -> AtmosphereData:
|
||||
return _meta[ATMOSPHERE] as AtmosphereData
|
||||
|
||||
var _areas : = {}
|
||||
|
||||
func _init():
|
||||
# add default atmoshere
|
||||
_areas["default"] = Area4D.new(1, AtmosphereData.new())
|
||||
|
||||
func get_area(name :String, default :Area4D = null) -> Area4D:
|
||||
return _areas.get(name, default)
|
||||
|
||||
|
||||
# test spy is called sub functions select(<type>) -> a(), b(), c()
|
||||
enum {
|
||||
A, B, C
|
||||
}
|
||||
|
||||
func a() -> String:
|
||||
return "a"
|
||||
|
||||
func b() -> String:
|
||||
return "b"
|
||||
|
||||
func c() -> String:
|
||||
return "c"
|
||||
|
||||
func select( type :int) -> String:
|
||||
match type:
|
||||
A: return a()
|
||||
B: return b()
|
||||
C: return c()
|
||||
_: return ""
|
||||
|
||||
static func to_foo() -> String:
|
||||
return "foo"
|
||||
Loading…
Add table
Add a link
Reference in a new issue