You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

validator_test.cc 1.8 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /**
  2. * Copyright 2020 Huawei Technologies Co., Ltd
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #include <iostream>
  17. #include <string>
  18. #include "common/common_test.h"
  19. #include "utils/log_adapter.h"
  20. #include "pipeline/jit/validator.h"
  21. #include "pipeline/jit/parse/parse.h"
  22. #include "ir/manager.h"
  23. #include "pipeline/jit/static_analysis/prim.h"
  24. #include "frontend/operator/ops.h"
  25. #include "base/core_ops.h"
  26. namespace mindspore {
  27. namespace validator {
  28. class TestValidator : public UT::Common {
  29. public:
  30. TestValidator() {}
  31. virtual ~TestValidator() {}
  32. virtual void TearDown() {}
  33. };
  34. TEST_F(TestValidator, ValidateOperation01) {
  35. auto node = NewValueNode(std::make_shared<Primitive>(prim::kScalarAdd));
  36. ValidateOperation(node);
  37. // normally, the above statement should not exit, so expected the following statement execute
  38. EXPECT_TRUE(true);
  39. }
  40. TEST_F(TestValidator, ValidateAbstract01) {
  41. AnfNodePtr node = NewValueNode(static_cast<int64_t>(1));
  42. abstract::AbstractBasePtr abstract_v1 = abstract::FromValue(static_cast<int64_t>(1), false);
  43. node->set_abstract(abstract_v1);
  44. ValidateAbstract(node);
  45. // normally, the above statement should not exit, so expected the following statement execute
  46. EXPECT_TRUE(true);
  47. }
  48. } // namespace validator
  49. } // namespace mindspore