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 20 #include "utils/log_adapter.h" 21 #include "pipeline/jit/validator.h" 22 #include "pipeline/jit/parse/parse.h" 23 #include "ir/manager.h" 24 #include "pipeline/jit/static_analysis/prim.h" 25 #include "frontend/operator/ops.h" 26 #include "base/core_ops.h" 27 28 namespace mindspore { 29 namespace validator { 30 class TestValidator : public UT::Common { 31 public: 32 TestValidator() {} 33 virtual ~TestValidator() {} 34 35 virtual void TearDown() {} 36 }; 37 38 TEST_F(TestValidator, ValidateOperation01) { 39 auto node = NewValueNode(std::make_shared<Primitive>(prim::kScalarAdd)); 40 ValidateOperation(node); 41 // normally, the above statement should not exit, so expected the following statement execute 42 EXPECT_TRUE(true); 43 } 44 45 TEST_F(TestValidator, ValidateAbstract01) { 46 AnfNodePtr node = NewValueNode(static_cast<int64_t>(1)); 47 abstract::AbstractBasePtr abstract_v1 = abstract::FromValue(static_cast<int64_t>(1), false); 48 node->set_abstract(abstract_v1); 49 ValidateAbstract(node); 50 // normally, the above statement should not exit, so expected the following statement execute 51 EXPECT_TRUE(true); 52 } 53 } // namespace validator 54 } // namespace mindspore 55