Skip to content

Instantly share code, notes, and snippets.

@fire
Created August 28, 2024 18:49
Show Gist options
  • Save fire/3e7bba9d3e6dd2339a2acadacc79903c to your computer and use it in GitHub Desktop.
Save fire/3e7bba9d3e6dd2339a2acadacc79903c to your computer and use it in GitHub Desktop.

Revisions

  1. fire created this gist Aug 28, 2024.
    358 changes: 358 additions & 0 deletions json_native.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,358 @@
    % ./bin/godot.macos.editor.double.arm64 --test -tc="[JSON][Native][SceneTree]*"
    [doctest] doctest version is "2.4.11"
    [doctest] run with "--help" for options
    ERROR: Parameter "obj" is null.
    at: get_property_list (core/variant/variant_setget.cpp:1297)
    ERROR: Parameter "obj" is null.
    at: get_property_list (core/variant/variant_setget.cpp:1297)
    ERROR: Parameter "obj" is null.
    at: get_property_list (core/variant/variant_setget.cpp:1297)
    ERROR: Parameter "obj" is null.
    at: get_property_list (core/variant/variant_setget.cpp:1297)
    ===============================================================================
    [doctest] test cases: 1 | 1 passed | 0 failed | 962 skipped
    [doctest] assertions: 39 | 39 passed | 0 failed |
    [doctest] Status: SUCCESS!
    WARNING: ObjectDB instances leaked at exit (run with --verbose for details).
    at: cleanup (core/object/object.cpp:2288)
    ernest.lee@Mac-mini godot % ./bin/godot.macos.editor.double.arm64 --test -tc="[JSON][Native][SceneTree]*" --success
    [doctest] doctest version is "2.4.11"
    [doctest] run with "--help" for options
    ===============================================================================
    ./tests/core/io/test_json_native.h:72:
    TEST CASE: [JSON][Native][SceneTree] Conversion between native and JSON formats

    ./tests/core/io/test_json_native.h:156: SUCCESS: CHECK( compare_variants(native_data, variant_native_converted) ) is correct!
    values: CHECK( true )
    logged: Conversion from native to JSON type Nil and back successful.
    Native: <null>
    Native Converted: <null>
    Error: 0
    Conversion from native to JSON type Nil successful: { "__gdtype": "Nil" }

    ./tests/core/io/test_json_native.h:156: SUCCESS: CHECK( compare_variants(native_data, variant_native_converted) ) is correct!
    values: CHECK( true )
    logged: Conversion from native to JSON type bool and back successful.
    Native: false
    Native Converted: false
    Error: 0
    Conversion from native to JSON type bool successful: false

    ./tests/core/io/test_json_native.h:156: SUCCESS: CHECK( compare_variants(native_data, variant_native_converted) ) is correct!
    values: CHECK( true )
    logged: Conversion from native to JSON type int and back successful.
    Native: 9223372036854775807
    Native Converted: 9223372036854775807
    Error: 0
    Conversion from native to JSON type int successful: 9223372036854775807

    ./tests/core/io/test_json_native.h:156: SUCCESS: CHECK( compare_variants(native_data, variant_native_converted) ) is correct!
    values: CHECK( true )
    logged: Conversion from native to JSON type float and back successful.
    Native: 9223372036854775808
    Native Converted: 9223372036854775808
    Error: 0
    Conversion from native to JSON type float successful: 9223372036854775808

    ./tests/core/io/test_json_native.h:156: SUCCESS: CHECK( compare_variants(native_data, variant_native_converted) ) is correct!
    values: CHECK( true )
    logged: Conversion from native to JSON type String and back successful.
    Native:
    Native Converted:
    Error: 0
    Conversion from native to JSON type String successful:

    ./tests/core/io/test_json_native.h:156: SUCCESS: CHECK( compare_variants(native_data, variant_native_converted) ) is correct!
    values: CHECK( true )
    logged: Conversion from native to JSON type Vector2 and back successful.
    Native: (0, 0)
    Native Converted: (0, 0)
    Error: 0
    Conversion from native to JSON type Vector2 successful: { "values": [0, 0], "__gdtype": "Vector2" }

    ./tests/core/io/test_json_native.h:156: SUCCESS: CHECK( compare_variants(native_data, variant_native_converted) ) is correct!
    values: CHECK( true )
    logged: Conversion from native to JSON type Vector2i and back successful.
    Native: (0, 0)
    Native Converted: (0, 0)
    Error: 0
    Conversion from native to JSON type Vector2i successful: { "values": [0, 0], "__gdtype": "Vector2i" }

    ./tests/core/io/test_json_native.h:156: SUCCESS: CHECK( compare_variants(native_data, variant_native_converted) ) is correct!
    values: CHECK( true )
    logged: Conversion from native to JSON type Rect2 and back successful.
    Native: [P: (0, 0), S: (0, 0)]
    Native Converted: [P: (0, 0), S: (0, 0)]
    Error: 0
    Conversion from native to JSON type Rect2 successful: { "position": { "values": [0, 0], "__gdtype": "Vector2" }, "size": { "values": [0, 0], "__gdtype": "Vector2" }, "__gdtype": "Rect2" }

    ./tests/core/io/test_json_native.h:156: SUCCESS: CHECK( compare_variants(native_data, variant_native_converted) ) is correct!
    values: CHECK( true )
    logged: Conversion from native to JSON type Rect2i and back successful.
    Native: [P: (0, 0), S: (0, 0)]
    Native Converted: [P: (0, 0), S: (0, 0)]
    Error: 0
    Conversion from native to JSON type Rect2i successful: { "position": { "values": [0, 0], "__gdtype": "Vector2i" }, "size": { "values": [0, 0], "__gdtype": "Vector2i" }, "__gdtype": "Rect2i" }

    ./tests/core/io/test_json_native.h:156: SUCCESS: CHECK( compare_variants(native_data, variant_native_converted) ) is correct!
    values: CHECK( true )
    logged: Conversion from native to JSON type Vector3 and back successful.
    Native: (0, 0, 0)
    Native Converted: (0, 0, 0)
    Error: 0
    Conversion from native to JSON type Vector3 successful: { "values": [0, 0, 0], "__gdtype": "Vector3" }

    ./tests/core/io/test_json_native.h:156: SUCCESS: CHECK( compare_variants(native_data, variant_native_converted) ) is correct!
    values: CHECK( true )
    logged: Conversion from native to JSON type Vector3i and back successful.
    Native: (0, 0, 0)
    Native Converted: (0, 0, 0)
    Error: 0
    Conversion from native to JSON type Vector3i successful: { "values": [0, 0, 0], "__gdtype": "Vector3i" }

    ./tests/core/io/test_json_native.h:156: SUCCESS: CHECK( compare_variants(native_data, variant_native_converted) ) is correct!
    values: CHECK( true )
    logged: Conversion from native to JSON type Transform2D and back successful.
    Native: [X: (1, 0), Y: (0, 1), O: (0, 0)]
    Native Converted: [X: (1, 0), Y: (0, 1), O: (0, 0)]
    Error: 0
    Conversion from native to JSON type Transform2D successful: { "x": { "values": [1, 0], "__gdtype": "Vector2" }, "y": { "values": [0, 1], "__gdtype": "Vector2" }, "origin": { "values": [0, 0], "__gdtype": "Vector2" }, "__gdtype": "Transform2D" }

    ./tests/core/io/test_json_native.h:156: SUCCESS: CHECK( compare_variants(native_data, variant_native_converted) ) is correct!
    values: CHECK( true )
    logged: Conversion from native to JSON type Vector4 and back successful.
    Native: (0, 0, 0, 0)
    Native Converted: (0, 0, 0, 0)
    Error: 0
    Conversion from native to JSON type Vector4 successful: { "values": [0, 0, 0, 0], "__gdtype": "Vector4" }

    ./tests/core/io/test_json_native.h:156: SUCCESS: CHECK( compare_variants(native_data, variant_native_converted) ) is correct!
    values: CHECK( true )
    logged: Conversion from native to JSON type Vector4i and back successful.
    Native: (0, 0, 0, 0)
    Native Converted: (0, 0, 0, 0)
    Error: 0
    Conversion from native to JSON type Vector4i successful: { "values": [0, 0, 0, 0], "__gdtype": "Vector4i" }

    ./tests/core/io/test_json_native.h:156: SUCCESS: CHECK( compare_variants(native_data, variant_native_converted) ) is correct!
    values: CHECK( true )
    logged: Conversion from native to JSON type Plane and back successful.
    Native: [N: (0, 0, 0), D: 0]
    Native Converted: [N: (0, 0, 0), D: 0]
    Error: 0
    Conversion from native to JSON type Plane successful: { "normal": { "values": [0, 0, 0], "__gdtype": "Vector3" }, "d": 0, "__gdtype": "Plane" }

    ./tests/core/io/test_json_native.h:156: SUCCESS: CHECK( compare_variants(native_data, variant_native_converted) ) is correct!
    values: CHECK( true )
    logged: Conversion from native to JSON type Quaternion and back successful.
    Native: (0, 0, 0, 1)
    Native Converted: (0, 0, 0, 1)
    Error: 0
    Conversion from native to JSON type Quaternion successful: { "values": [0, 0, 0, 1], "__gdtype": "Quaternion" }

    ./tests/core/io/test_json_native.h:156: SUCCESS: CHECK( compare_variants(native_data, variant_native_converted) ) is correct!
    values: CHECK( true )
    logged: Conversion from native to JSON type AABB and back successful.
    Native: [P: (0, 0, 0), S: (0, 0, 0)]
    Native Converted: [P: (0, 0, 0), S: (0, 0, 0)]
    Error: 0
    Conversion from native to JSON type AABB successful: { "position": { "values": [0, 0, 0], "__gdtype": "Vector3" }, "size": { "values": [0, 0, 0], "__gdtype": "Vector3" }, "__gdtype": "AABB" }

    ./tests/core/io/test_json_native.h:156: SUCCESS: CHECK( compare_variants(native_data, variant_native_converted) ) is correct!
    values: CHECK( true )
    logged: Conversion from native to JSON type Basis and back successful.
    Native: [X: (1, 0, 0), Y: (0, 1, 0), Z: (0, 0, 1)]
    Native Converted: [X: (1, 0, 0), Y: (0, 1, 0), Z: (0, 0, 1)]
    Error: 0
    Conversion from native to JSON type Basis successful: { "x": { "values": [1, 0, 0], "__gdtype": "Vector3" }, "y": { "values": [0, 1, 0], "__gdtype": "Vector3" }, "z": { "values": [0, 0, 1], "__gdtype": "Vector3" }, "__gdtype": "Basis" }

    ./tests/core/io/test_json_native.h:156: SUCCESS: CHECK( compare_variants(native_data, variant_native_converted) ) is correct!
    values: CHECK( true )
    logged: Conversion from native to JSON type Transform3D and back successful.
    Native: [X: (1, 0, 0), Y: (0, 1, 0), Z: (0, 0, 1), O: (0, 0, 0)]
    Native Converted: [X: (1, 0, 0), Y: (0, 1, 0), Z: (0, 0, 1), O: (0, 0, 0)]
    Error: 0
    Conversion from native to JSON type Transform3D successful: { "basis": { "x": { "values": [1, 0, 0], "__gdtype": "Vector3" }, "y": { "values": [0, 1, 0], "__gdtype": "Vector3" }, "z": { "values": [0, 0, 1], "__gdtype": "Vector3" }, "__gdtype": "Basis" }, "origin": { "values": [0, 0, 0], "__gdtype": "Vector3" }, "__gdtype": "Transform3D" }

    ./tests/core/io/test_json_native.h:156: SUCCESS: CHECK( compare_variants(native_data, variant_native_converted) ) is correct!
    values: CHECK( true )
    logged: Conversion from native to JSON type Projection and back successful.
    Native:
    1, 0, 0, 0
    0, 1, 0, 0
    0, 0, 1, 0
    0, 0, 0, 1
    Native Converted:
    1, 0, 0, 0
    0, 1, 0, 0
    0, 0, 1, 0
    0, 0, 0, 1
    Error: 0
    Conversion from native to JSON type Projection successful: { "x": { "values": [1, 0, 0, 0], "__gdtype": "Vector4" }, "y": { "values": [0, 1, 0, 0], "__gdtype": "Vector4" }, "z": { "values": [0, 0, 1, 0], "__gdtype": "Vector4" }, "w": { "values": [0, 0, 0, 1], "__gdtype": "Vector4" }, "__gdtype": "Projection" }

    ./tests/core/io/test_json_native.h:156: SUCCESS: CHECK( compare_variants(native_data, variant_native_converted) ) is correct!
    values: CHECK( true )
    logged: Conversion from native to JSON type Color and back successful.
    Native: (0, 0, 0, 1)
    Native Converted: (0, 0, 0, 1)
    Error: 0
    Conversion from native to JSON type Color successful: { "values": [0, 0, 0, 1], "__gdtype": "Color" }

    ./tests/core/io/test_json_native.h:156: SUCCESS: CHECK( compare_variants(native_data, variant_native_converted) ) is correct!
    values: CHECK( true )
    logged: Conversion from native to JSON type StringName and back successful.
    Native:
    Native Converted:
    Error: 0
    Conversion from native to JSON type StringName successful: { "name": "", "__gdtype": "StringName" }

    ./tests/core/io/test_json_native.h:156: SUCCESS: CHECK( compare_variants(native_data, variant_native_converted) ) is correct!
    values: CHECK( true )
    logged: Conversion from native to JSON type NodePath and back successful.
    Native:
    Native Converted:
    Error: 0
    Conversion from native to JSON type NodePath successful: { "path": "", "__gdtype": "NodePath" }

    ./tests/core/io/test_json_native.h:156: SUCCESS: CHECK( compare_variants(native_data, variant_native_converted) ) is correct!
    values: CHECK( true )
    logged: Conversion from native to JSON type RID and back successful.
    Native: RID(0)
    Native Converted: <null>
    Error: 0
    Conversion from native to JSON type RID successful: { "__gdtype": "RID" }

    ERROR: Parameter "obj" is null.
    at: get_property_list (core/variant/variant_setget.cpp:1297)
    ERROR: Parameter "obj" is null.
    at: get_property_list (core/variant/variant_setget.cpp:1297)
    ERROR: Parameter "obj" is null.
    at: get_property_list (core/variant/variant_setget.cpp:1297)
    ERROR: Parameter "obj" is null.
    at: get_property_list (core/variant/variant_setget.cpp:1297)
    ./tests/core/io/test_json_native.h:156: SUCCESS: CHECK( compare_variants(native_data, variant_native_converted) ) is correct!
    values: CHECK( true )
    logged: Conversion from native to JSON type Object and back successful.
    Native: <Node#8740929979>
    Native Converted: <Node#8757707196>
    Error: 0
    Conversion from native to JSON type Object successful: { "type": "Node", "properties": { "_import_path": { "path": "", "__gdtype": "NodePath" }, "unique_name_in_owner": false, "process_mode": 0, "process_priority": 0, "process_physics_priority": 0, "process_thread_group": 0, "physics_interpolation_mode": 0, "auto_translate_mode": 0, "editor_description": "", "script": { "__gdtype": "Nil" } }, "__gdtype": "Object" }

    ./tests/core/io/test_json_native.h:156: SUCCESS: CHECK( compare_variants(native_data, variant_native_converted) ) is correct!
    values: CHECK( true )
    logged: Conversion from native to JSON type Callable and back successful.
    Native: null::null
    Native Converted: <null>
    Error: 0
    Conversion from native to JSON type Callable successful: { "__gdtype": "Callable" }

    ./tests/core/io/test_json_native.h:156: SUCCESS: CHECK( compare_variants(native_data, variant_native_converted) ) is correct!
    values: CHECK( true )
    logged: Conversion from native to JSON type Signal and back successful.
    Native: null::[signal]
    Native Converted: <null>
    Error: 0
    Conversion from native to JSON type Signal successful: { "__gdtype": "Signal" }

    ./tests/core/io/test_json_native.h:156: SUCCESS: CHECK( compare_variants(native_data, variant_native_converted) ) is correct!
    values: CHECK( true )
    logged: Conversion from native to JSON type Dictionary and back successful.
    Native: { "key": "value" }
    Native Converted: { "key": "value" }
    Error: 0
    Conversion from native to JSON type Dictionary successful: { "key": "value" }

    ./tests/core/io/test_json_native.h:156: SUCCESS: CHECK( compare_variants(native_data, variant_native_converted) ) is correct!
    values: CHECK( true )
    logged: Conversion from native to JSON type Array and back successful.
    Native: ["element1", "element2"]
    Native Converted: ["element1", "element2"]
    Error: 0
    Conversion from native to JSON type Array successful: ["element1", "element2"]

    ./tests/core/io/test_json_native.h:156: SUCCESS: CHECK( compare_variants(native_data, variant_native_converted) ) is correct!
    values: CHECK( true )
    logged: Conversion from native to JSON type PackedByteArray and back successful.
    Native: [1, 2]
    Native Converted: [1, 2]
    Error: 0
    Conversion from native to JSON type PackedByteArray successful: { "values": [1, 2], "__gdtype": "PackedByteArray" }

    ./tests/core/io/test_json_native.h:156: SUCCESS: CHECK( compare_variants(native_data, variant_native_converted) ) is correct!
    values: CHECK( true )
    logged: Conversion from native to JSON type PackedInt32Array and back successful.
    Native: [-2147483648, 2147483647]
    Native Converted: [-2147483648, 2147483647]
    Error: 0
    Conversion from native to JSON type PackedInt32Array successful: { "values": [-2147483648, 2147483647], "__gdtype": "PackedInt32Array" }

    ./tests/core/io/test_json_native.h:156: SUCCESS: CHECK( compare_variants(native_data, variant_native_converted) ) is correct!
    values: CHECK( true )
    logged: Conversion from native to JSON type PackedInt64Array and back successful.
    Native: [-9223372036854775808, 9223372036854775807]
    Native Converted: [-9223372036854775808, 9223372036854775807]
    Error: 0
    Conversion from native to JSON type PackedInt64Array successful: { "values": [-9223372036854775808, 9223372036854775807], "__gdtype": "PackedInt64Array" }

    ./tests/core/io/test_json_native.h:156: SUCCESS: CHECK( compare_variants(native_data, variant_native_converted) ) is correct!
    values: CHECK( true )
    logged: Conversion from native to JSON type PackedFloat32Array and back successful.
    Native: [0, 340282346638528859811704183484516925440]
    Native Converted: [0, 340282346638528859811704183484516925440]
    Error: 0
    Conversion from native to JSON type PackedFloat32Array successful: { "values": [0, 340282346638528859811704183484516925440], "__gdtype": "PackedFloat32Array" }

    ./tests/core/io/test_json_native.h:156: SUCCESS: CHECK( compare_variants(native_data, variant_native_converted) ) is correct!
    values: CHECK( true )
    logged: Conversion from native to JSON type PackedFloat64Array and back successful.
    Native: [0, 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368]
    Native Converted: [0, 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368]
    Error: 0
    Conversion from native to JSON type PackedFloat64Array successful: { "values": [0, 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368], "__gdtype": "PackedFloat64Array" }

    ./tests/core/io/test_json_native.h:156: SUCCESS: CHECK( compare_variants(native_data, variant_native_converted) ) is correct!
    values: CHECK( true )
    logged: Conversion from native to JSON type PackedStringArray and back successful.
    Native: ["string1", "string2"]
    Native Converted: ["string1", "string2"]
    Error: 0
    Conversion from native to JSON type PackedStringArray successful: { "values": ["string1", "string2"], "__gdtype": "PackedStringArray" }

    ./tests/core/io/test_json_native.h:156: SUCCESS: CHECK( compare_variants(native_data, variant_native_converted) ) is correct!
    values: CHECK( true )
    logged: Conversion from native to JSON type PackedVector2Array and back successful.
    Native: [(1, 2)]
    Native Converted: [(1, 2)]
    Error: 0
    Conversion from native to JSON type PackedVector2Array successful: { "values": [1, 2], "__gdtype": "PackedVector2Array" }

    ./tests/core/io/test_json_native.h:156: SUCCESS: CHECK( compare_variants(native_data, variant_native_converted) ) is correct!
    values: CHECK( true )
    logged: Conversion from native to JSON type PackedVector3Array and back successful.
    Native: [(1, 2, 3)]
    Native Converted: [(1, 2, 3)]
    Error: 0
    Conversion from native to JSON type PackedVector3Array successful: { "values": [1, 2, 3], "__gdtype": "PackedVector3Array" }

    ./tests/core/io/test_json_native.h:156: SUCCESS: CHECK( compare_variants(native_data, variant_native_converted) ) is correct!
    values: CHECK( true )
    logged: Conversion from native to JSON type PackedColorArray and back successful.
    Native: [(1, 1, 1, 1)]
    Native Converted: [(1, 1, 1, 1)]
    Error: 0
    Conversion from native to JSON type PackedColorArray successful: { "values": [1, 1, 1, 1], "__gdtype": "PackedColorArray" }

    ./tests/core/io/test_json_native.h:156: SUCCESS: CHECK( compare_variants(native_data, variant_native_converted) ) is correct!
    values: CHECK( true )
    logged: Conversion from native to JSON type PackedVector4Array and back successful.
    Native: [(1, 2, 3, 4)]
    Native Converted: [(1, 2, 3, 4)]
    Error: 0
    Conversion from native to JSON type PackedVector4Array successful: { "values": [1, 2, 3, 4], "__gdtype": "PackedVector4Array" }

    ===============================================================================
    [doctest] test cases: 1 | 1 passed | 0 failed | 962 skipped
    [doctest] assertions: 39 | 39 passed | 0 failed |
    [doctest] Status: SUCCESS!
    WARNING: ObjectDB instances leaked at exit (run with --verbose for details).
    at: cleanup (core/object/object.cpp:2288)