/* * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution. * * SPDX-License-Identifier: Apache-2.0 OR MIT * */ #include #include #include #include #include #include #include #include #include #include using namespace ScriptCanvasTests; using namespace TestNodes; TEST_F(ScriptCanvasTestFixture, CoreNodeFunction_OwningGraphCheck) { using namespace ScriptCanvas; ScriptCanvas::Graph* graph = CreateGraph(); ConfigurableUnitTestNode* groupedNode = CreateConfigurableNode(); EXPECT_EQ(graph, groupedNode->GetGraph()); } TEST_F(ScriptCanvasTestFixture, AddRemoveSlotNotifications) { RegisterComponentDescriptor(); using namespace ScriptCanvas; AZStd::unique_ptr numberAddEntity = AZStd::make_unique("numberAddEntity"); auto numberAddNode = numberAddEntity->CreateComponent(); numberAddEntity->Init(); ScriptUnitTestNodeNotificationHandler nodeNotifications(numberAddNode->GetEntityId()); SlotId testSlotId = numberAddNode->AddSlot("test"); EXPECT_EQ(1U, nodeNotifications.GetSlotsAdded()); numberAddNode->RemoveSlot(testSlotId); EXPECT_EQ(1U, nodeNotifications.GetSlotsRemoved()); testSlotId = numberAddNode->AddSlot("duplicate"); EXPECT_EQ(2U, nodeNotifications.GetSlotsAdded()); // This should not signal the NodeNotification::OnSlotAdded event as the slot already exist on the node SlotId duplicateSlotId = numberAddNode->AddSlot("duplicate"); EXPECT_EQ(2U, nodeNotifications.GetSlotsAdded()); EXPECT_EQ(testSlotId, duplicateSlotId); numberAddNode->RemoveSlot(testSlotId); EXPECT_EQ(2U, nodeNotifications.GetSlotsRemoved()); // This should not signal the NodeNotification::OnSlotRemoved event as the slot no longer exist on the node numberAddNode->RemoveSlot(testSlotId, false); EXPECT_EQ(2U, nodeNotifications.GetSlotsRemoved()); numberAddEntity.reset(); } TEST_F(ScriptCanvasTestFixture, InsertSlot_Basic) { using namespace ScriptCanvas; ScriptCanvas::Graph* graph = CreateGraph(); ConfigurableUnitTestNode* basicNode = CreateConfigurableNode(); SlotId firstSlotAdded; SlotId secondSlotAdded; SlotId thirdSlotAdded; { DataSlotConfiguration slotConfiguration; slotConfiguration.m_name = "A"; slotConfiguration.SetDefaultValue(0); slotConfiguration.SetConnectionType(ConnectionType::Input); Slot* slot = basicNode->AddTestingSlot(slotConfiguration); firstSlotAdded = slot->GetId(); } { DataSlotConfiguration slotConfiguration; slotConfiguration.m_name = "C"; slotConfiguration.SetDefaultValue(2); slotConfiguration.SetConnectionType(ConnectionType::Input); Slot* slot = basicNode->AddTestingSlot(slotConfiguration); secondSlotAdded = slot->GetId(); } { DataSlotConfiguration slotConfiguration; slotConfiguration.m_name = "B"; slotConfiguration.SetDefaultValue(1); slotConfiguration.SetConnectionType(ConnectionType::Input); auto index = basicNode->FindSlotIndex(secondSlotAdded); EXPECT_EQ(index, 1); Slot* slot = basicNode->InsertTestingSlot(index, slotConfiguration); thirdSlotAdded = slot->GetId(); } { AZStd::vector< const Slot* > slotList = basicNode->GetAllSlots(); EXPECT_EQ(slotList.size(), 3); { const Slot* firstSlot = slotList[0]; EXPECT_EQ(firstSlot->GetId(), firstSlotAdded); EXPECT_EQ(firstSlot->GetName(), "A"); EXPECT_FLOAT_EQ(static_cast((*firstSlot->FindDatum()->GetAs())), 0.0f); } { const Slot* secondSlot = slotList[1]; EXPECT_EQ(secondSlot->GetId(), thirdSlotAdded); EXPECT_EQ(secondSlot->GetName(), "B"); EXPECT_FLOAT_EQ(static_cast((*secondSlot->FindDatum()->GetAs())), 1.0f); } { const Slot* thirdSlot = slotList[2]; EXPECT_EQ(thirdSlot->GetId(), secondSlotAdded); EXPECT_EQ(thirdSlot->GetName(), "C"); EXPECT_FLOAT_EQ(static_cast((*thirdSlot->FindDatum()->GetAs())), 2.0f); } } graph->Activate(); { AZStd::vector< const Slot* > slotList = basicNode->GetAllSlots(); EXPECT_EQ(slotList.size(), 3); { const Slot* firstSlot = slotList[0]; EXPECT_EQ(firstSlot->GetId(), firstSlotAdded); EXPECT_EQ(firstSlot->GetName(), "A"); EXPECT_FLOAT_EQ(static_cast((*firstSlot->FindDatum()->GetAs())), 0.0f); } { const Slot* secondSlot = slotList[1]; EXPECT_EQ(secondSlot->GetId(), thirdSlotAdded); EXPECT_EQ(secondSlot->GetName(), "B"); EXPECT_FLOAT_EQ(static_cast((*secondSlot->FindDatum()->GetAs())), 1.0f); } { const Slot* thirdSlot = slotList[2]; EXPECT_EQ(thirdSlot->GetId(), secondSlotAdded); EXPECT_EQ(thirdSlot->GetName(), "C"); EXPECT_FLOAT_EQ(static_cast((*thirdSlot->FindDatum()->GetAs())), 2.0f); } } graph->Deactivate(); { const AZStd::vector< const Slot* > slotList = basicNode->GetAllSlots(); EXPECT_EQ(slotList.size(), 3); { const Slot* firstSlot = slotList[0]; EXPECT_EQ(firstSlot->GetId(), firstSlotAdded); EXPECT_EQ(firstSlot->GetName(), "A"); EXPECT_FLOAT_EQ(static_cast((*firstSlot->FindDatum()->GetAs())), 0.0f); } { const Slot* secondSlot = slotList[1]; EXPECT_EQ(secondSlot->GetId(), thirdSlotAdded); EXPECT_EQ(secondSlot->GetName(), "B"); EXPECT_FLOAT_EQ(static_cast((*secondSlot->FindDatum()->GetAs())), 1.0f); } { const Slot* thirdSlot = slotList[2]; EXPECT_EQ(thirdSlot->GetId(), secondSlotAdded); EXPECT_EQ(thirdSlot->GetName(), "C"); EXPECT_FLOAT_EQ(static_cast((*thirdSlot->FindDatum()->GetAs())), 2.0f); } } } TEST_F(ScriptCanvasTestFixture, InsertSlot_FrontPadded) { using namespace ScriptCanvas; ScriptCanvas::Graph* graph = CreateGraph(); ConfigurableUnitTestNode* basicNode = CreateConfigurableNode(); basicNode->AddTestingSlot(ExecutionSlotConfiguration("Input", ConnectionType::Input)); basicNode->AddTestingSlot(ExecutionSlotConfiguration("Input-1", ConnectionType::Input)); basicNode->AddTestingSlot(ExecutionSlotConfiguration("Input-2", ConnectionType::Input)); basicNode->AddTestingSlot(ExecutionSlotConfiguration("Input-3", ConnectionType::Input)); SlotId firstSlotAdded; SlotId secondSlotAdded; SlotId thirdSlotAdded; { DataSlotConfiguration slotConfiguration; slotConfiguration.m_name = "A"; slotConfiguration.SetDefaultValue(0); slotConfiguration.SetConnectionType(ConnectionType::Input); Slot* slot = basicNode->AddTestingSlot(slotConfiguration); firstSlotAdded = slot->GetId(); } { DataSlotConfiguration slotConfiguration; slotConfiguration.m_name = "C"; slotConfiguration.SetDefaultValue(2); slotConfiguration.SetConnectionType(ConnectionType::Input); Slot* slot = basicNode->AddTestingSlot(slotConfiguration); secondSlotAdded = slot->GetId(); } { DataSlotConfiguration slotConfiguration; slotConfiguration.m_name = "B"; slotConfiguration.SetDefaultValue(1); slotConfiguration.SetConnectionType(ConnectionType::Input); auto index = basicNode->FindSlotIndex(secondSlotAdded); Slot* slot = basicNode->InsertTestingSlot(index, slotConfiguration); thirdSlotAdded = slot->GetId(); } { AZStd::vector< const Slot* > slotList = basicNode->FindSlotsByDescriptor(SlotDescriptors::DataIn()); EXPECT_EQ(slotList.size(), 3); { const Slot* firstSlot = slotList[0]; EXPECT_EQ(firstSlot->GetId(), firstSlotAdded); EXPECT_EQ(firstSlot->GetName(), "A"); EXPECT_FLOAT_EQ(static_cast((*firstSlot->FindDatum()->GetAs())), 0.0f); } { const Slot* secondSlot = slotList[1]; EXPECT_EQ(secondSlot->GetId(), thirdSlotAdded); EXPECT_EQ(secondSlot->GetName(), "B"); EXPECT_FLOAT_EQ(static_cast((*secondSlot->FindDatum()->GetAs())), 1.0f); } { const Slot* thirdSlot = slotList[2]; EXPECT_EQ(thirdSlot->GetId(), secondSlotAdded); EXPECT_EQ(thirdSlot->GetName(), "C"); EXPECT_FLOAT_EQ(static_cast((*thirdSlot->FindDatum()->GetAs())), 2.0f); } } graph->Activate(); { AZStd::vector< const Slot* > slotList = basicNode->FindSlotsByDescriptor(SlotDescriptors::DataIn()); EXPECT_EQ(slotList.size(), 3); { const Slot* firstSlot = slotList[0]; EXPECT_EQ(firstSlot->GetId(), firstSlotAdded); EXPECT_EQ(firstSlot->GetName(), "A"); EXPECT_FLOAT_EQ(static_cast((*firstSlot->FindDatum()->GetAs())), 0.0f); } { const Slot* secondSlot = slotList[1]; EXPECT_EQ(secondSlot->GetId(), thirdSlotAdded); EXPECT_EQ(secondSlot->GetName(), "B"); EXPECT_FLOAT_EQ(static_cast((*secondSlot->FindDatum()->GetAs())), 1.0f); } { const Slot* thirdSlot = slotList[2]; EXPECT_EQ(thirdSlot->GetId(), secondSlotAdded); EXPECT_EQ(thirdSlot->GetName(), "C"); EXPECT_FLOAT_EQ(static_cast((*thirdSlot->FindDatum()->GetAs())), 2.0f); } } graph->Deactivate(); { AZStd::vector< const Slot* > slotList = basicNode->FindSlotsByDescriptor(SlotDescriptors::DataIn()); EXPECT_EQ(slotList.size(), 3); { const Slot* firstSlot = slotList[0]; EXPECT_EQ(firstSlot->GetId(), firstSlotAdded); EXPECT_EQ(firstSlot->GetName(), "A"); EXPECT_FLOAT_EQ(static_cast((*firstSlot->FindDatum()->GetAs())), 0.0f); } { const Slot* secondSlot = slotList[1]; EXPECT_EQ(secondSlot->GetId(), thirdSlotAdded); EXPECT_EQ(secondSlot->GetName(), "B"); EXPECT_FLOAT_EQ(static_cast((*secondSlot->FindDatum()->GetAs())), 1.0f); } { const Slot* thirdSlot = slotList[2]; EXPECT_EQ(thirdSlot->GetId(), secondSlotAdded); EXPECT_EQ(thirdSlot->GetName(), "C"); EXPECT_FLOAT_EQ(static_cast((*thirdSlot->FindDatum()->GetAs())), 2.0f); } } } TEST_F(ScriptCanvasTestFixture, ValueTypes) { using namespace ScriptCanvas; Datum number0(Datum(0)); int number0Value = *number0.GetAs(); Datum number1(Datum(1)); int number1Value = *number1.GetAs(); Datum numberFloat(Datum(2.f)); float numberFloatValue = *numberFloat.GetAs(); Datum numberDouble(Datum(3.0)); double numberDoubleValue = *numberDouble.GetAs(); Datum numberHex(Datum(0xff)); /*int numberHexValue =*/ *numberHex.GetAs(); Datum numberPi(Datum(3.14f)); float numberPiValue = *numberPi.GetAs(); Datum numberSigned(Datum(-100)); /*int numberSignedValue =*/ *numberSigned.GetAs(); Datum numberUnsigned(Datum(100u)); /*unsigned int numberUnsignedValue =*/ *numberUnsigned.GetAs(); Datum numberDoublePi(Datum(6.28)); double numberDoublePiValue = *numberDoublePi.GetAs(); EXPECT_EQ(number0Value, 0); EXPECT_EQ(number1Value, 1); EXPECT_TRUE(AZ::IsClose(numberFloatValue, 2.f, std::numeric_limits::epsilon())); EXPECT_TRUE(AZ::IsClose(numberDoubleValue, 3.0, std::numeric_limits::epsilon())); EXPECT_NE(number0Value, number1Value); SC_EXPECT_FLOAT_EQ(numberPiValue, 3.14f); EXPECT_NE(number0Value, numberPiValue); EXPECT_NE(numberPiValue, numberDoublePiValue); Datum boolTrue(Datum(true)); EXPECT_TRUE(*boolTrue.GetAs()); Datum boolFalse(Datum(false)); EXPECT_FALSE(*boolFalse.GetAs()); boolFalse = boolTrue; EXPECT_TRUE(*boolFalse.GetAs()); Datum boolFalse2(Datum(false)); boolTrue = boolFalse2; EXPECT_FALSE(*boolTrue.GetAs()); { const int k_count(10000); AZStd::vector objects; for (int i = 0; i < k_count; ++i) { objects.push_back(Datum("Vector3", Datum::eOriginality::Original)); } } GTEST_SUCCEED(); } TEST_F(ScriptCanvasTestFixture, Contracts) { using namespace ScriptCanvas; RegisterComponentDescriptor(); ////////////////////////////////////////////////////////////////////////// // Make the graph. ScriptCanvas::Graph* graph = nullptr; SystemRequestBus::BroadcastResult(graph, &SystemRequests::MakeGraph); EXPECT_TRUE(graph != nullptr); graph->GetEntity()->Init(); const ScriptCanvasId& graphUniqueId = graph->GetScriptCanvasId(); // Make the nodes. // Start AZ::Entity* startEntity{ aznew AZ::Entity("Start") }; startEntity->Init(); AZ::EntityId startNode{ startEntity->GetId() }; SystemRequestBus::Broadcast(&SystemRequests::CreateNodeOnEntity, startNode, graphUniqueId, ScriptCanvas::Nodes::Core::Start::TYPEINFO_Uuid()); // ContractNode 0 AZ::Entity* contract0Entity{ aznew AZ::Entity("Contract 0") }; contract0Entity->Init(); AZ::EntityId contract0Node{ contract0Entity->GetId() }; SystemRequestBus::Broadcast(&SystemRequests::CreateNodeOnEntity, contract0Node, graphUniqueId, ContractNode::TYPEINFO_Uuid()); // ContractNode 1 AZ::Entity* contract1Entity{ aznew AZ::Entity("Contract 1") }; contract1Entity->Init(); AZ::EntityId contract1Node{ contract1Entity->GetId() }; SystemRequestBus::Broadcast(&SystemRequests::CreateNodeOnEntity, contract1Node, graphUniqueId, ContractNode::TYPEINFO_Uuid()); // invalid { ScriptCanvasEditor::ScopedOutputSuppression suppressOutput; EXPECT_FALSE(graph->Connect(startNode, AZ::EntityUtils::FindFirstDerivedComponent(startEntity)->GetSlotId("Out"), contract0Node, AZ::EntityUtils::FindFirstDerivedComponent(contract0Entity)->GetSlotId("Out"))); EXPECT_FALSE(graph->Connect(startNode, AZ::EntityUtils::FindFirstDerivedComponent(startEntity)->GetSlotId("In"), contract0Node, AZ::EntityUtils::FindFirstDerivedComponent(contract0Entity)->GetSlotId("In"))); EXPECT_FALSE(graph->Connect(startNode, AZ::EntityUtils::FindFirstDerivedComponent(startEntity)->GetSlotId("In"), contract0Node, AZ::EntityUtils::FindFirstDerivedComponent(contract0Entity)->GetSlotId("Get String"))); EXPECT_FALSE(graph->Connect(startNode, AZ::EntityUtils::FindFirstDerivedComponent(startEntity)->GetSlotId("Out"), contract0Node, AZ::EntityUtils::FindFirstDerivedComponent(contract0Entity)->GetSlotId("Get String"))); EXPECT_FALSE(graph->Connect(startNode, AZ::EntityUtils::FindFirstDerivedComponent(startEntity)->GetSlotId("In"), contract0Node, AZ::EntityUtils::FindFirstDerivedComponent(contract0Entity)->GetSlotId("Set String"))); EXPECT_FALSE(graph->Connect(startNode, AZ::EntityUtils::FindFirstDerivedComponent(startEntity)->GetSlotId("Out"), contract0Node, AZ::EntityUtils::FindFirstDerivedComponent(contract0Entity)->GetSlotId("Set String"))); EXPECT_FALSE(graph->Connect(contract0Node, AZ::EntityUtils::FindFirstDerivedComponent(contract0Entity)->GetSlotId("Set String"), contract1Node, AZ::EntityUtils::FindFirstDerivedComponent(contract1Entity)->GetSlotId("Set String"))); EXPECT_FALSE(graph->Connect(contract0Node, AZ::EntityUtils::FindFirstDerivedComponent(contract0Entity)->GetSlotId("Set String"), contract1Node, AZ::EntityUtils::FindFirstDerivedComponent(contract1Entity)->GetSlotId("Set Number"))); EXPECT_FALSE(graph->Connect(contract0Node, AZ::EntityUtils::FindFirstDerivedComponent(contract0Entity)->GetSlotId("Get String"), contract1Node, AZ::EntityUtils::FindFirstDerivedComponent(contract1Entity)->GetSlotId("Set Number"))); EXPECT_FALSE(graph->Connect(contract0Node, AZ::EntityUtils::FindFirstDerivedComponent(contract0Entity)->GetSlotId("Set String"), contract1Node, AZ::EntityUtils::FindFirstDerivedComponent(contract1Entity)->GetSlotId("Set String"))); EXPECT_FALSE(graph->Connect(contract0Node, AZ::EntityUtils::FindFirstDerivedComponent(contract0Entity)->GetSlotId("Out"), contract0Node, AZ::EntityUtils::FindFirstDerivedComponent(contract0Entity)->GetSlotId("In"))); } // valid EXPECT_TRUE(graph->Connect(startNode, AZ::EntityUtils::FindFirstDerivedComponent(startEntity)->GetSlotId("Out"), contract0Node, AZ::EntityUtils::FindFirstDerivedComponent(contract0Entity)->GetSlotId("In"))); EXPECT_TRUE(graph->Connect(contract0Node, AZ::EntityUtils::FindFirstDerivedComponent(contract0Entity)->GetSlotId("Set String"), contract1Node, AZ::EntityUtils::FindFirstDerivedComponent(contract1Entity)->GetSlotId("Get String"))); EXPECT_TRUE(graph->Connect(contract0Node, AZ::EntityUtils::FindFirstDerivedComponent(contract0Entity)->GetSlotId("In"), contract1Node, AZ::EntityUtils::FindFirstDerivedComponent(contract1Entity)->GetSlotId("Out"))); EXPECT_TRUE(graph->Connect(contract0Node, AZ::EntityUtils::FindFirstDerivedComponent(contract0Entity)->GetSlotId("Set Number"), contract1Node, AZ::EntityUtils::FindFirstDerivedComponent(contract1Entity)->GetSlotId("Get Number"))); // Execute it graph->GetEntity()->Activate(); ReportErrors(graph); graph->GetEntity()->Deactivate(); delete graph->GetEntity(); } // // TEST_F(ScriptCanvasTestFixture, BinaryOperationTest) // { // // using namespace ScriptCanvas::Nodes; // using namespace ScriptCanvas::Nodes::Comparison; // // TestBehaviorContextObject::Reflect(m_serializeContext); // TestBehaviorContextObject::Reflect(m_behaviorContext); // // BinaryOpTest(1, 1, true); // BinaryOpTest(1, 0, false); // BinaryOpTest(0, 1, false); // BinaryOpTest(0, 0, true); // // BinaryOpTest(1, 1, false); // BinaryOpTest(1, 0, true); // BinaryOpTest(0, 1, true); // BinaryOpTest(0, 0, false); // // BinaryOpTest(1, 1, false); // BinaryOpTest(1, 0, true); // BinaryOpTest(0, 1, false); // BinaryOpTest(0, 0, false); // // BinaryOpTest(1, 1, true); // BinaryOpTest(1, 0, true); // BinaryOpTest(0, 1, false); // BinaryOpTest(0, 0, true); // // BinaryOpTest(1, 1, false); // BinaryOpTest(1, 0, false); // BinaryOpTest(0, 1, true); // BinaryOpTest(0, 0, false); // // BinaryOpTest(1, 1, true); // BinaryOpTest(1, 0, false); // BinaryOpTest(0, 1, true); // BinaryOpTest(0, 0, true); // // BinaryOpTest(true, true, true); // BinaryOpTest(true, false, false); // BinaryOpTest(false, true, false); // BinaryOpTest(false, false, true); // // BinaryOpTest(true, true, false); // BinaryOpTest(true, false, true); // BinaryOpTest(false, true, true); // BinaryOpTest(false, false, false); // // AZStd::string string0("a string"); // AZStd::string string1("b string"); // // BinaryOpTest(string1, string1, true); // BinaryOpTest(string1, string0, false); // BinaryOpTest(string0, string1, false); // BinaryOpTest(string0, string0, true); // // BinaryOpTest(string1, string1, false); // BinaryOpTest(string1, string0, true); // BinaryOpTest(string0, string1, true); // BinaryOpTest(string0, string0, false); // // BinaryOpTest(string1, string1, false); // BinaryOpTest(string1, string0, true); // BinaryOpTest(string0, string1, false); // BinaryOpTest(string0, string0, false); // // BinaryOpTest(string1, string1, true); // BinaryOpTest(string1, string0, true); // BinaryOpTest(string0, string1, false); // BinaryOpTest(string0, string0, true); // // BinaryOpTest(string1, string1, false); // BinaryOpTest(string1, string0, false); // BinaryOpTest(string0, string1, true); // BinaryOpTest(string0, string0, false); // // BinaryOpTest(string1, string1, true); // BinaryOpTest(string1, string0, false); // BinaryOpTest(string0, string1, true); // BinaryOpTest(string0, string0, true); // // const AZ::Vector3 vectorOne(1.0f, 1.0f, 1.0f); // const AZ::Vector3 vectorZero(0.0f, 0.0f, 0.0f); // // BinaryOpTest(vectorOne, vectorOne, true); // BinaryOpTest(vectorOne, vectorZero, false); // BinaryOpTest(vectorZero, vectorOne, false); // BinaryOpTest(vectorZero, vectorZero, true); // // BinaryOpTest(vectorOne, vectorOne, false); // BinaryOpTest(vectorOne, vectorZero, true); // BinaryOpTest(vectorZero, vectorOne, true); // BinaryOpTest(vectorZero, vectorZero, false); // // const TestBehaviorContextObject zero(0); // const TestBehaviorContextObject one(1); // const TestBehaviorContextObject otherOne(1); // // BinaryOpTest(one, one, true); // BinaryOpTest(one, zero, false); // BinaryOpTest(zero, one, false); // BinaryOpTest(zero, zero, true); // // BinaryOpTest(one, one, false); // BinaryOpTest(one, zero, true); // BinaryOpTest(zero, one, true); // BinaryOpTest(zero, zero, false); // // BinaryOpTest(one, one, false); // BinaryOpTest(one, zero, true); // BinaryOpTest(zero, one, false); // BinaryOpTest(zero, zero, false); // // BinaryOpTest(one, one, true); // BinaryOpTest(one, zero, true); // BinaryOpTest(zero, one, false); // BinaryOpTest(zero, zero, true); // // BinaryOpTest(one, one, false); // BinaryOpTest(one, zero, false); // BinaryOpTest(zero, one, true); // BinaryOpTest(zero, zero, false); // // BinaryOpTest(one, one, true); // BinaryOpTest(one, zero, false); // BinaryOpTest(zero, one, true); // BinaryOpTest(zero, zero, true); // // BinaryOpTest(one, otherOne, true); // BinaryOpTest(otherOne, one, true); // // BinaryOpTest(one, otherOne, false); // BinaryOpTest(otherOne, one, false); // // BinaryOpTest(one, otherOne, false); // BinaryOpTest(otherOne, one, false); // // BinaryOpTest(one, otherOne, true); // BinaryOpTest(otherOne, one, true); // // BinaryOpTest(one, otherOne, false); // BinaryOpTest(otherOne, one, false); // // BinaryOpTest(one, otherOne, true); // BinaryOpTest(otherOne, one, true); // // // force failures, to verify crash proofiness // BinaryOpTest(one, zero, false, true); // BinaryOpTest(one, zero, true, true); // BinaryOpTest(one, zero, true, true); // BinaryOpTest(one, zero, true, true); // BinaryOpTest(one, zero, false, true); // BinaryOpTest(one, zero, false, true); // // m_serializeContext->EnableRemoveReflection(); // m_behaviorContext->EnableRemoveReflection(); // TestBehaviorContextObject::Reflect(m_serializeContext); // TestBehaviorContextObject::Reflect(m_behaviorContext); // m_serializeContext->DisableRemoveReflection(); // m_behaviorContext->DisableRemoveReflection(); // } const int k_executionCount = 998; TEST_F(ScriptCanvasTestFixture, ExecutionLength) { using namespace ScriptCanvas; ScriptCanvas::Graph* graph(nullptr); SystemRequestBus::BroadcastResult(graph, &SystemRequests::MakeGraph); EXPECT_TRUE(graph != nullptr); graph->GetEntity()->Init(); const ScriptCanvasId& graphUniqueId = graph->GetScriptCanvasId(); AZ::EntityId startID; CreateTestNode(graphUniqueId, startID); AZ::EntityId previousID = startID; for (int i = 0; i < k_executionCount; ++i) { AZ::EntityId printNodeID; TestResult* printNode = CreateTestNode(graphUniqueId, printNodeID); printNode->SetInput_UNIT_TEST("Value", i); EXPECT_TRUE(Connect(*graph, previousID, "Out", printNodeID, "In")); previousID = printNodeID; } AZ::Entity* graphEntity = graph->GetEntity(); { ScriptCanvasEditor::ScopedOutputSuppression suppressOutput; graphEntity->Activate(); } ReportErrors(graph); graphEntity->Deactivate(); delete graphEntity; } TEST_F(ScriptCanvasTestFixture, While) { RunUnitTestGraph("LY_SC_UnitTest_While", ScriptCanvas::ExecutionMode::Interpreted); } TEST_F(ScriptCanvasTestFixture, WhileBreak) { RunUnitTestGraph("LY_SC_UnitTest_WhileBreak", ScriptCanvas::ExecutionMode::Interpreted); }