TestAutoGenFunctions.cpp 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. #include "TestAutoGenFunctions.h"
  9. namespace ScriptCanvasTesting
  10. {
  11. namespace TestAutoGenFunctions
  12. {
  13. float NoArgsReturn()
  14. {
  15. return 0.0f;
  16. }
  17. AZStd::tuple<AZStd::string, bool> ArgsReturnMulti(double input)
  18. {
  19. return input >= 0.0 ? AZStd::make_tuple("positive", true) : AZStd::make_tuple("negative", false);
  20. }
  21. AZStd::tuple<AZStd::string, bool> NoArgsReturnMulti()
  22. {
  23. return AZStd::make_tuple("no-args", false);
  24. }
  25. int MaxReturnByValueInteger(int lhs, int rhs)
  26. {
  27. return lhs >= rhs ? lhs : rhs;
  28. }
  29. const int* MaxReturnByPointerInteger(const int* lhs, const int* rhs)
  30. {
  31. return (lhs && rhs && (*lhs) >= (*rhs)) ? lhs : rhs;
  32. }
  33. const int& MaxReturnByReferenceInteger(const int& lhs, const int& rhs)
  34. {
  35. return lhs >= rhs ? lhs : rhs;
  36. }
  37. bool IsPositive(int input)
  38. {
  39. return input > 0;
  40. }
  41. bool NegateBranchBooleanNoResult(int input)
  42. {
  43. return -1 * input > 0;
  44. }
  45. int NegateBranchNonBooleanWithResult(int input)
  46. {
  47. return -1 * input;
  48. }
  49. } // namespace TestAutoGenFunctions
  50. } // namespace ScriptCanvasTesting