mirror of
https://github.com/luau-lang/luau.git
synced 2025-04-07 12:20:53 +01:00
Clean up VectorConstants test. Add legacy constructor test case.
This commit is contained in:
parent
186b4e693b
commit
69b481cb06
1 changed files with 12 additions and 6 deletions
|
@ -5108,39 +5108,45 @@ TEST_CASE("VectorConstants")
|
||||||
ScopedFastFlag luauVectorBuiltins{FFlag::LuauVectorBuiltins, true};
|
ScopedFastFlag luauVectorBuiltins{FFlag::LuauVectorBuiltins, true};
|
||||||
ScopedFastFlag luauVector2Constants{FFlag::LuauVector2Constants, true};
|
ScopedFastFlag luauVector2Constants{FFlag::LuauVector2Constants, true};
|
||||||
|
|
||||||
CHECK_EQ("\n" + compileFunction("return vector.create(1, 2)", 0, 2, 0, /*enableVectors*/ true), R"(
|
CHECK_EQ("\n" + compileFunction("return vector.create(1, 2)", 0, 2, 0), R"(
|
||||||
LOADK R0 K0 [1, 2, 0]
|
LOADK R0 K0 [1, 2, 0]
|
||||||
RETURN R0 1
|
RETURN R0 1
|
||||||
)");
|
)");
|
||||||
|
|
||||||
CHECK_EQ("\n" + compileFunction("return vector.create(1, 2, 3)", 0, 2, 0, /*enableVectors*/ true), R"(
|
CHECK_EQ("\n" + compileFunction("return vector.create(1, 2, 3)", 0, 2, 0), R"(
|
||||||
LOADK R0 K0 [1, 2, 3]
|
LOADK R0 K0 [1, 2, 3]
|
||||||
RETURN R0 1
|
RETURN R0 1
|
||||||
)");
|
)");
|
||||||
|
|
||||||
CHECK_EQ("\n" + compileFunction("print(vector.create(1, 2, 3))", 0, 2, 0, /*enableVectors*/ true), R"(
|
CHECK_EQ("\n" + compileFunction("print(vector.create(1, 2, 3))", 0, 2, 0), R"(
|
||||||
GETIMPORT R0 1 [print]
|
GETIMPORT R0 1 [print]
|
||||||
LOADK R1 K2 [1, 2, 3]
|
LOADK R1 K2 [1, 2, 3]
|
||||||
CALL R0 1 0
|
CALL R0 1 0
|
||||||
RETURN R0 0
|
RETURN R0 0
|
||||||
)");
|
)");
|
||||||
|
|
||||||
CHECK_EQ("\n" + compileFunction("print(vector.create(1, 2, 3, 4))", 0, 2, 0, /*enableVectors*/ true), R"(
|
CHECK_EQ("\n" + compileFunction("print(vector.create(1, 2, 3, 4))", 0, 2, 0), R"(
|
||||||
GETIMPORT R0 1 [print]
|
GETIMPORT R0 1 [print]
|
||||||
LOADK R1 K2 [1, 2, 3, 4]
|
LOADK R1 K2 [1, 2, 3, 4]
|
||||||
CALL R0 1 0
|
CALL R0 1 0
|
||||||
RETURN R0 0
|
RETURN R0 0
|
||||||
)");
|
)");
|
||||||
|
|
||||||
CHECK_EQ("\n" + compileFunction("return vector.create(0, 0, 0), vector.create(-0, 0, 0)", 0, 2, 0, /*enableVectors*/ true), R"(
|
CHECK_EQ("\n" + compileFunction("return vector.create(0, 0, 0), vector.create(-0, 0, 0)", 0, 2, 0), R"(
|
||||||
LOADK R0 K0 [0, 0, 0]
|
LOADK R0 K0 [0, 0, 0]
|
||||||
LOADK R1 K1 [-0, 0, 0]
|
LOADK R1 K1 [-0, 0, 0]
|
||||||
RETURN R0 2
|
RETURN R0 2
|
||||||
)");
|
)");
|
||||||
|
|
||||||
CHECK_EQ("\n" + compileFunction("return type(vector.create(0, 0, 0))", 0, 2, 0, /*enableVectors*/ true), R"(
|
CHECK_EQ("\n" + compileFunction("return type(vector.create(0, 0, 0))", 0, 2, 0), R"(
|
||||||
LOADK R0 K0 ['vector']
|
LOADK R0 K0 ['vector']
|
||||||
RETURN R0 1
|
RETURN R0 1
|
||||||
|
)");
|
||||||
|
|
||||||
|
// test legacy constructor
|
||||||
|
CHECK_EQ("\n" + compileFunction("return Vector3.new(1, 2, 3)", 0, 2, 0, /*enableVectors*/ true), R"(
|
||||||
|
LOADK R0 K0 [1, 2, 3]
|
||||||
|
RETURN R0 1
|
||||||
)");
|
)");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue