godot/modules/gdscript/tests/scripts/analyzer/features/const_conversions.gd

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

24 lines
875 B
GDScript3
Raw Normal View History

2023-01-22 08:32:05 +00:00
const const_float_int: float = 19
const const_float_plus: float = 12 + 22
const const_float_cast: float = 76 as float
const const_packed_empty: PackedFloat64Array = []
const const_packed_ints: PackedFloat64Array = [52]
func test():
Utils.check(typeof(const_float_int) == TYPE_FLOAT)
Utils.check(str(const_float_int) == '19')
Utils.check(typeof(const_float_plus) == TYPE_FLOAT)
Utils.check(str(const_float_plus) == '34')
Utils.check(typeof(const_float_cast) == TYPE_FLOAT)
Utils.check(str(const_float_cast) == '76')
2023-01-22 08:32:05 +00:00
Utils.check(typeof(const_packed_empty) == TYPE_PACKED_FLOAT64_ARRAY)
Utils.check(str(const_packed_empty) == '[]')
Utils.check(typeof(const_packed_ints) == TYPE_PACKED_FLOAT64_ARRAY)
Utils.check(str(const_packed_ints) == '[52]')
Utils.check(typeof(const_packed_ints[0]) == TYPE_FLOAT)
Utils.check(str(const_packed_ints[0]) == '52')
2023-01-22 08:32:05 +00:00
print('ok')