PrefabTestUtils.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #pragma once
  9. #include <vector>
  10. #include <memory>
  11. #include <Prefab/Instance/Instance.h>
  12. namespace UnitTest
  13. {
  14. namespace PrefabTestUtils
  15. {
  16. using namespace AzToolsFramework::Prefab;
  17. template<typename... InstanceArgs>
  18. inline AZStd::vector<AZStd::unique_ptr<Instance>> MakeInstanceList(InstanceArgs&&... instances)
  19. {
  20. static_assert((AZStd::is_same_v<InstanceArgs, AZStd::unique_ptr<Instance>>&& ...), "All arguments must be a AZStd::unique_ptr<Instance>&&");
  21. AZStd::vector<AZStd::unique_ptr<Instance>> instanceList;
  22. instanceList.reserve(sizeof...(InstanceArgs));
  23. (instanceList.emplace_back(AZStd::forward<InstanceArgs>(instances)), ...);
  24. return instanceList;
  25. }
  26. inline AZStd::vector<AZStd::unique_ptr<Instance>> MakeInstanceList()
  27. {
  28. return {};
  29. }
  30. }
  31. }