1 /* 2 * Copyright (C) 2018 The Android Open Source Project 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 17 #ifndef LIBTEXTCLASSIFIER_ANNOTATOR_NUMBER_NUMBER_TEST_INCLUDE_H_ 18 #define LIBTEXTCLASSIFIER_ANNOTATOR_NUMBER_NUMBER_TEST_INCLUDE_H_ 19 20 #include "annotator/model_generated.h" 21 #include "annotator/number/number.h" 22 #include "utils/jvm-test-utils.h" 23 #include "gtest/gtest.h" 24 25 namespace libtextclassifier3 { 26 namespace test_internal { 27 28 class NumberAnnotatorTest : public ::testing::Test { 29 private: 30 protected: 31 explicit NumberAnnotatorTest(ModeFlag enabled_modes = ModeFlag_ALL) unilib_(CreateUniLibForTesting ())32 : unilib_(CreateUniLibForTesting()), 33 number_annotator_(TestingNumberAnnotatorOptions(enabled_modes), 34 unilib_.get()) {} 35 36 const NumberAnnotatorOptions* TestingNumberAnnotatorOptions( 37 ModeFlag enabled_modes); 38 39 std::unique_ptr<UniLib> unilib_; 40 NumberAnnotator number_annotator_; 41 }; 42 43 class NumberAnnotatorForAnnotationAndClassificationTest 44 : public NumberAnnotatorTest { 45 protected: NumberAnnotatorForAnnotationAndClassificationTest()46 NumberAnnotatorForAnnotationAndClassificationTest() 47 : NumberAnnotatorTest(ModeFlag_ANNOTATION_AND_CLASSIFICATION) {} 48 }; 49 50 class NumberAnnotatorForSelectionTest : public NumberAnnotatorTest { 51 protected: NumberAnnotatorForSelectionTest()52 NumberAnnotatorForSelectionTest() : NumberAnnotatorTest(ModeFlag_SELECTION) {} 53 }; 54 55 } // namespace test_internal 56 } // namespace libtextclassifier3 57 58 #endif // LIBTEXTCLASSIFIER_ANNOTATOR_NUMBER_NUMBER_TEST_INCLUDE_H_ 59