!35502 [MD] Adding docstrings for minddata UT Cpp Part 1

Merge pull request !35502 from davidanugraha/add_cpp_test_comment
This commit is contained in:
i-robot 2022-06-13 12:16:02 +00:00 committed by Gitee
commit 309c01d800
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
92 changed files with 4298 additions and 1979 deletions

View File

@ -1,5 +1,5 @@
/**
* Copyright 2021 Huawei Technologies Co., Ltd
* Copyright 2021-2022 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -70,6 +70,9 @@ std::vector<double> GenerateMatrix(const std::shared_ptr<Tensor> &input, float_t
return matrix;
}
/// Feature: Affine op
/// Description: Test Affine op using lite_mat_rgb
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestAffineOp, TestAffineLite) {
MS_LOG(INFO) << "Doing MindDataTestAffine-TestAffineLite.";
@ -80,7 +83,7 @@ TEST_F(MindDataTestAffineOp, TestAffineLite) {
std::vector<float> shear = {0.0, 0.0};
// Create affine object with default values
std::shared_ptr<AffineOp> op(new AffineOp(degree, translation, scale, shear, InterpolationMode::kLinear));
auto op = std::make_shared<AffineOp>(degree, translation, scale, shear, InterpolationMode::kLinear);
// output tensor
std::shared_ptr<Tensor> output_tensor;

View File

@ -1,5 +1,5 @@
/**
* Copyright 2019 Huawei Technologies Co., Ltd
* Copyright 2019-2022 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -28,7 +28,9 @@ class MindDataTestArena : public UT::Common {
MindDataTestArena() {}
};
/// Feature: Arena
/// Description: Test Arena basic usage
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestArena, Test1) {
std::shared_ptr<Arena> mp;
Status rc = Arena::CreateArena(&mp);
@ -48,6 +50,9 @@ TEST_F(MindDataTestArena, Test1) {
MS_LOG(DEBUG) << *mp;
}
/// Feature: Arena
/// Description: Test copy and move
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestArena, Test2) {
std::shared_ptr<Arena> arena;
Status rc = Arena::CreateArena(&arena);

View File

@ -1,5 +1,5 @@
/**
* Copyright 2020 Huawei Technologies Co., Ltd
* Copyright 2020-2022 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -29,11 +29,14 @@ class MindDataTestAutoContrastOp : public UT::CVOP::CVOpCommon {
MindDataTestAutoContrastOp() : CVOpCommon() {}
};
/// Feature: AutoContrast op
/// Description: Test AutoContrast op basic usage
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestAutoContrastOp, TestOp1) {
MS_LOG(INFO) << "Doing testAutoContrastOp.";
std::shared_ptr<Tensor> output_tensor;
std::unique_ptr<AutoContrastOp> op(new AutoContrastOp(1.0, {0, 255}));
auto op = std::make_unique<AutoContrastOp>(1.0, std::vector<uint32_t>{0, 255});
EXPECT_TRUE(op->OneToOne());
Status s = op->Compute(input_tensor_, &output_tensor);
EXPECT_TRUE(s.IsOk());

View File

@ -1,5 +1,5 @@
/**
* Copyright 2019 Huawei Technologies Co., Ltd
* Copyright 2019-2022 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -23,7 +23,9 @@ class MindDataTestBits : public UT::Common {
MindDataTestBits() {}
};
/// Feature: Bit functions
/// Description: Test Bit functions basic usage
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestBits, Basics) {
uint32_t x = 0; // 00000
BitSet(&x, 16); // 10000

View File

@ -1,5 +1,5 @@
/**
* Copyright 2020 Huawei Technologies Co., Ltd
* Copyright 2020-2022 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -31,6 +31,9 @@ class MindDataTestBoundingBoxAugmentOp : public UT::CVOP::BBOXOP::BBoxOpCommon {
MindDataTestBoundingBoxAugmentOp() : UT::CVOP::BBOXOP::BBoxOpCommon() {}
};
/// Feature: BoundingBoxAugment op
/// Description: Test BoundingBoxAugment op basic usage
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestBoundingBoxAugmentOp, TestOp) {
MS_LOG(INFO) << "Doing testBoundingBoxAugment.";
TensorTable results;

View File

@ -1,5 +1,5 @@
/**
* Copyright 2019 Huawei Technologies Co., Ltd
* Copyright 2019-2022 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -40,7 +40,9 @@ class MindDataTestBPlusTree : public UT::Common {
MindDataTestBPlusTree() = default;
};
// Test serial insert.
/// Feature: Btree
/// Description: Test Btree serial insert
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestBPlusTree, Test1) {
Allocator<std::string> alloc(std::make_shared<SystemPool>());
BPlusTree<uint64_t, std::string, Allocator<std::string>, std::less<>, mytraits> btree(alloc);
@ -105,7 +107,9 @@ TEST_F(MindDataTestBPlusTree, Test1) {
}
}
// Test concurrent insert.
/// Feature: Btree
/// Description: Test Btree concurrent insert
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestBPlusTree, Test2) {
Allocator<std::string> alloc(std::make_shared<SystemPool>());
BPlusTree<uint64_t, std::string, Allocator<std::string>, std::less<>, mytraits> btree(alloc);
@ -179,6 +183,9 @@ TEST_F(MindDataTestBPlusTree, Test2) {
}
}
/// Feature: AutoIndexObj
/// Description: Test AutoIndexObj basic usage
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestBPlusTree, Test3) {
Allocator<std::string> alloc(std::make_shared<SystemPool>());
AutoIndexObj<std::string, Allocator<std::string>> ai(alloc);
@ -200,6 +207,9 @@ TEST_F(MindDataTestBPlusTree, Test3) {
}
}
/// Feature: AutoIndexObj
/// Description: Test AutoIndexObj iterator function
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestBPlusTree, Test4) {
Allocator<int64_t> alloc(std::make_shared<SystemPool>());
AutoIndexObj<int64_t, Allocator<int64_t>> ai(alloc);
@ -227,6 +237,9 @@ TEST_F(MindDataTestBPlusTree, Test4) {
}
}
/// Feature: Btree
/// Description: Test Btree with no locking
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestBPlusTree, TestPerfNoLocking) {
AutoIndexObj<int64_t> btree;
// No locking test

View File

@ -1,5 +1,5 @@
/**
* Copyright 2020-2021 Huawei Technologies Co., Ltd
* Copyright 2020-2022 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -29,6 +29,9 @@ class MindDataTestVocab : public UT::DatasetOpTesting {
protected:
};
/// Feature: Vocab
/// Description: Test building Vocab using BuildFromUnorderedMap
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestVocab, TestVocabFromUnorderedMap) {
MS_LOG(INFO) << "Doing MindDataTestVocab-TestVocabFromUnorderedMap.";
// Build a map
@ -52,6 +55,9 @@ TEST_F(MindDataTestVocab, TestVocabFromUnorderedMap) {
}
}
/// Feature: Vocab
/// Description: Test building Vocab from empty map
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestVocab, TestVocabFromEmptyMap) {
MS_LOG(INFO) << "Doing MindDataTestVocab-TestVocabFromEmptyMap.";
// Build vocab from empty map
@ -70,6 +76,9 @@ TEST_F(MindDataTestVocab, TestVocabFromEmptyMap) {
}
}
/// Feature: Vocab
/// Description: Test building Vocab with negative index of word
/// Expectation: Throw correct error and message
TEST_F(MindDataTestVocab, TestVocabFromMapFail) {
MS_LOG(INFO) << "Doing MindDataTestVocab-TestVocabFromMapFail.";
// Build a map
@ -83,6 +92,9 @@ TEST_F(MindDataTestVocab, TestVocabFromMapFail) {
EXPECT_NE(s, Status::OK());
}
/// Feature: Vocab
/// Description: Test building Vocab from vector of words where special tokens are prepended to vocab
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestVocab, TestVocabFromVectorPrependSpTokens) {
MS_LOG(INFO) << "Doing MindDataTestVocab-TestVocabFromVectorPrependSpTokens.";
// Build vocab from a vector of words, special tokens are prepended to vocab
@ -101,6 +113,9 @@ TEST_F(MindDataTestVocab, TestVocabFromVectorPrependSpTokens) {
}
}
/// Feature: Vocab
/// Description: Test building Vocab from vector of words where special tokens are appended to vocab
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestVocab, TestVocabFromVectorAppendSpTokens) {
MS_LOG(INFO) << "Doing MindDataTestVocab-TestVocabFromVectorAppendSpTokens.";
// Build vocab from a vector of words, special tokens are appended to vocab
@ -118,6 +133,9 @@ TEST_F(MindDataTestVocab, TestVocabFromVectorAppendSpTokens) {
}
}
/// Feature: Vocab
/// Description: Test building Vocab from vector of words with no special tokens
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestVocab, TestVocabFromVectorWithNoSpTokens) {
MS_LOG(INFO) << "Doing MindDataTestVocab-TestVocabFromVectorWithNoSpTokens.";
// Build vocab from a vector of words with no special tokens
@ -136,6 +154,9 @@ TEST_F(MindDataTestVocab, TestVocabFromVectorWithNoSpTokens) {
}
}
/// Feature: Vocab
/// Description: Test building Vocab from empty vector
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestVocab, TestVocabFromEmptyVector) {
MS_LOG(INFO) << "Doing MindDataTestVocab-TestVocabFromEmptyVector.";
// Build vocab from empty vector
@ -154,6 +175,9 @@ TEST_F(MindDataTestVocab, TestVocabFromEmptyVector) {
}
}
/// Feature: Vocab
/// Description: Test building Vocab with duplicate words
/// Expectation: Throw correct error and message
TEST_F(MindDataTestVocab, TestVocabFromVectorFail1) {
MS_LOG(INFO) << "Doing MindDataTestVocab-TestVocabFromVectorFail1.";
// Build vocab from a vector of words
@ -166,6 +190,9 @@ TEST_F(MindDataTestVocab, TestVocabFromVectorFail1) {
EXPECT_NE(s, Status::OK());
}
/// Feature: Vocab
/// Description: Test building Vocab with duplicate special token
/// Expectation: Throw correct error and message
TEST_F(MindDataTestVocab, TestVocabFromVectorFail2) {
MS_LOG(INFO) << "Doing MindDataTestVocab-TestVocabFromVectorFail2.";
// Build vocab from a vector
@ -178,6 +205,9 @@ TEST_F(MindDataTestVocab, TestVocabFromVectorFail2) {
EXPECT_NE(s, Status::OK());
}
/// Feature: Vocab
/// Description: Test building Vocab with special tokens that already exist in word_list
/// Expectation: Throw correct error and message
TEST_F(MindDataTestVocab, TestVocabFromVectorFail3) {
MS_LOG(INFO) << "Doing MindDataTestVocab-TestVocabFromVectorFail3.";
// Build vocab from a vector
@ -190,6 +220,9 @@ TEST_F(MindDataTestVocab, TestVocabFromVectorFail3) {
EXPECT_NE(s, Status::OK());
}
/// Feature: Vocab
/// Description: Test building Vocab from local file
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestVocab, TestVocabFromFile) {
MS_LOG(INFO) << "Doing MindDataTestVocab-TestVocabFromFile.";
// Build vocab from local file
@ -207,6 +240,9 @@ TEST_F(MindDataTestVocab, TestVocabFromFile) {
}
}
/// Feature: Vocab
/// Description: Test building Vocab from local file which does not exist
/// Expectation: Throw correct error and message
TEST_F(MindDataTestVocab, TestVocabFromFileFail1) {
MS_LOG(INFO) << "Doing MindDataTestVocab-TestVocabFromFileFail1.";
// Build vocab from local file which is not exist
@ -216,6 +252,9 @@ TEST_F(MindDataTestVocab, TestVocabFromFileFail1) {
EXPECT_NE(s, Status::OK());
}
/// Feature: Vocab
/// Description: Test building Vocab from local file with invalid vocab_size
/// Expectation: Throw correct error and message
TEST_F(MindDataTestVocab, TestVocabFromFileFail2) {
MS_LOG(INFO) << "Doing MindDataTestVocab-TestVocabFromFileFail2.";
// Build vocab from local file
@ -227,6 +266,9 @@ TEST_F(MindDataTestVocab, TestVocabFromFileFail2) {
EXPECT_NE(s, Status::OK());
}
/// Feature: Vocab
/// Description: Test building Vocab from local file with duplicate special token
/// Expectation: Throw correct error and message
TEST_F(MindDataTestVocab, TestVocabFromFileFail3) {
MS_LOG(INFO) << "Doing MindDataTestVocab-TestVocabFromFileFail3.";
// Build vocab from local file
@ -238,6 +280,9 @@ TEST_F(MindDataTestVocab, TestVocabFromFileFail3) {
EXPECT_NE(s, Status::OK());
}
/// Feature: Vocab
/// Description: Test building Vocab from local file with special tokens and word_list that contain duplicate word
/// Expectation: Throw correct error and message
TEST_F(MindDataTestVocab, TestVocabFromFileFail4) {
MS_LOG(INFO) << "Doing MindDataTestVocab-TestVocabFromFileFail4.";
// Build vocab from local file

View File

@ -31,6 +31,9 @@ class MindDataTestPipeline : public UT::DatasetOpTesting {
protected:
};
/// Feature: AmplitudeToDB op
/// Description: Test AmplitudeToDB op pipelined
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestAmplitudeToDBPipeline) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestAmplitudeToDBPipeline.";
// Original waveform
@ -69,6 +72,9 @@ TEST_F(MindDataTestPipeline, TestAmplitudeToDBPipeline) {
iter->Stop();
}
/// Feature: AmplitudeToDB op
/// Description: Test AmplitudeToDB op with wrong arguments
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestAmplitudeToDBWrongArgs) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestAmplitudeToDBWrongArgs.";
// Original waveform
@ -90,6 +96,9 @@ TEST_F(MindDataTestPipeline, TestAmplitudeToDBWrongArgs) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: BandBiquad op
/// Description: Test BandBiquad op basic usage
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestBandBiquadBasic) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestBandBiquadBasic.";
// Original waveform
@ -129,6 +138,9 @@ TEST_F(MindDataTestPipeline, TestBandBiquadBasic) {
iter->Stop();
}
/// Feature: BandBiquad op
/// Description: Test BandBiquad op with invalid Q_ and sample_rate
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestBandBiquadParamCheck) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestBandBiquadParamCheck.";
std::shared_ptr<SchemaObj> schema = Schema();
@ -158,6 +170,9 @@ TEST_F(MindDataTestPipeline, TestBandBiquadParamCheck) {
EXPECT_EQ(iter02, nullptr);
}
/// Feature: AllpassBiquad op
/// Description: Test AllpassBiquad op basic usage
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestAllpassBiquadBasic) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestAllpassBiquadBasic.";
// Original waveform
@ -197,6 +212,9 @@ TEST_F(MindDataTestPipeline, TestAllpassBiquadBasic) {
iter->Stop();
}
/// Feature: AllpassBiquad op
/// Description: Test AllpassBiquad op with invalid Q_ and sample_rate
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestAllpassBiquadParamCheck) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestAllpassBiquadParamCheck.";
std::shared_ptr<SchemaObj> schema = Schema();
@ -226,6 +244,9 @@ TEST_F(MindDataTestPipeline, TestAllpassBiquadParamCheck) {
EXPECT_EQ(iter02, nullptr);
}
/// Feature: BandpassBiquad op
/// Description: Test BandpassBiquad op basic usage
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestBandpassBiquadBasic) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestBandpassBiquadBasic.";
// Original waveform
@ -265,6 +286,9 @@ TEST_F(MindDataTestPipeline, TestBandpassBiquadBasic) {
iter->Stop();
}
/// Feature: BandpassBiquad op
/// Description: Test BandpassBiquad op with invalid Q_ and sample_rate
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestBandpassBiquadParamCheck) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestBandpassBiquadParamCheck.";
std::shared_ptr<SchemaObj> schema = Schema();
@ -294,6 +318,9 @@ TEST_F(MindDataTestPipeline, TestBandpassBiquadParamCheck) {
EXPECT_EQ(iter02, nullptr);
}
/// Feature: BandrejectBiquad op
/// Description: Test BandrejectBiquad op basic usage
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestBandrejectBiquadBasic) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestBandrejectBiquadBasic.";
// Original waveform
@ -333,6 +360,9 @@ TEST_F(MindDataTestPipeline, TestBandrejectBiquadBasic) {
iter->Stop();
}
/// Feature: BandrejectBiquad op
/// Description: Test BandrejectBiquad op with invalid Q_ and sample_rate
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestBandrejectBiquadParamCheck) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestBandrejectBiquadParamCheck.";
std::shared_ptr<SchemaObj> schema = Schema();
@ -362,6 +392,9 @@ TEST_F(MindDataTestPipeline, TestBandrejectBiquadParamCheck) {
EXPECT_EQ(iter02, nullptr);
}
/// Feature: BassBiquad op
/// Description: Test BassBiquad op basic usage
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestBassBiquadBasic) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestBassBiquadBasic.";
// Original waveform
@ -401,6 +434,9 @@ TEST_F(MindDataTestPipeline, TestBassBiquadBasic) {
iter->Stop();
}
/// Feature: BassBiquad op
/// Description: Test BassBiquad op with invalid Q_ and sample_rate
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestBassBiquadParamCheck) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestBassBiquadParamCheck.";
std::shared_ptr<SchemaObj> schema = Schema();
@ -430,6 +466,9 @@ TEST_F(MindDataTestPipeline, TestBassBiquadParamCheck) {
EXPECT_EQ(iter02, nullptr);
}
/// Feature: Angle op
/// Description: Test Angle op with pipeline mode
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestAnglePipeline) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestAnglePipeline.";
@ -468,6 +507,9 @@ TEST_F(MindDataTestPipeline, TestAnglePipeline) {
iter->Stop();
}
/// Feature: Angle op
/// Description: Test Angle op with pipeline mode with invalid input
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestAnglePipelineError) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestAnglePipelineError.";
@ -489,6 +531,9 @@ TEST_F(MindDataTestPipeline, TestAnglePipelineError) {
EXPECT_ERROR(iter->GetNextRow(&row));
}
/// Feature: EqualizerBiquad op
/// Description: Test EqualizerBiquad op basic usage
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestEqualizerBiquadSuccess) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestEqualizerBiquadSuccess.";
@ -499,7 +544,7 @@ TEST_F(MindDataTestPipeline, TestEqualizerBiquadSuccess) {
EXPECT_NE(ds, nullptr);
// Create a filter object
std::shared_ptr<TensorTransform> equalizer_biquad(new audio::EqualizerBiquad(44100, 3.5, 5.5, 0.707));
auto equalizer_biquad = std::make_shared<audio::EqualizerBiquad>(44100, 3.5, 5.5, 0.707);
auto ds1 = ds->Map({equalizer_biquad}, {"col1"}, {"audio"});
EXPECT_NE(ds1, nullptr);
std::shared_ptr<Iterator> iter = ds1->CreateIterator();
@ -515,6 +560,9 @@ TEST_F(MindDataTestPipeline, TestEqualizerBiquadSuccess) {
iter->Stop();
}
/// Feature: EqualizerBiquad op
/// Description: Test EqualizerBiquad op with invalid sample_rate and Q_
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestEqualizerBiquadWrongArgs) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestEqualizerBiquadWrongArgs.";
std::shared_ptr<SchemaObj> schema = Schema();
@ -544,6 +592,9 @@ TEST_F(MindDataTestPipeline, TestEqualizerBiquadWrongArgs) {
EXPECT_EQ(iter02, nullptr);
}
/// Feature: LowpassBiquad op
/// Description: Test LowpassBiquad op basic usage
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestLowpassBiquadSuccess) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestLowpassBiquadSuccess.";
@ -554,7 +605,7 @@ TEST_F(MindDataTestPipeline, TestLowpassBiquadSuccess) {
EXPECT_NE(ds, nullptr);
// Create a filter object
std::shared_ptr<TensorTransform> lowpass_biquad(new audio::LowpassBiquad(44100, 3000.5, 0.707));
auto lowpass_biquad = std::make_shared<audio::LowpassBiquad>(44100, 3000.5, 0.707);
auto ds1 = ds->Map({lowpass_biquad}, {"col1"}, {"audio"});
EXPECT_NE(ds1, nullptr);
std::shared_ptr<Iterator> iter = ds1->CreateIterator();
@ -570,6 +621,9 @@ TEST_F(MindDataTestPipeline, TestLowpassBiquadSuccess) {
iter->Stop();
}
/// Feature: LowpassBiquad op
/// Description: Test LowpassBiquad op with invalid sample_rate and Q_
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestLowpassBiquadWrongArgs) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestLowpassBiquadWrongArgs.";
std::shared_ptr<SchemaObj> schema = Schema();
@ -599,6 +653,9 @@ TEST_F(MindDataTestPipeline, TestLowpassBiquadWrongArgs) {
EXPECT_EQ(iter02, nullptr);
}
/// Feature: FrequencyMasking op
/// Description: Test FrequencyMaking op with pipeline mode
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestFrequencyMaskingPipeline) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestFrequencyMaskingPipeline.";
// Original waveform
@ -637,6 +694,9 @@ TEST_F(MindDataTestPipeline, TestFrequencyMaskingPipeline) {
iter->Stop();
}
/// Feature: FrequencyMasking op
/// Description: Test FrequencyMaking op with invalid arguments
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestFrequencyMaskingWrongArgs) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestFrequencyMaskingWrongArgs.";
// Original waveform
@ -659,6 +719,9 @@ TEST_F(MindDataTestPipeline, TestFrequencyMaskingWrongArgs) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: ComplexNorm op
/// Description: Test ComplexNorm op basic usage
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestComplexNormBasic) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestComplexNormBasic.";
@ -698,6 +761,9 @@ TEST_F(MindDataTestPipeline, TestComplexNormBasic) {
iter->Stop();
}
/// Feature: ComplexNorm op
/// Description: Test ComplexNorm op with wrong arguments
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestComplexNormWrongArgs) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestComplexNormWrongArgs.";
@ -717,6 +783,9 @@ TEST_F(MindDataTestPipeline, TestComplexNormWrongArgs) {
EXPECT_EQ(iter1, nullptr);
}
/// Feature: Contrast op
/// Description: Test Contrast op basic usage
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestContrastBasic) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestContrastBasic.";
// Original waveform
@ -755,6 +824,9 @@ TEST_F(MindDataTestPipeline, TestContrastBasic) {
iter->Stop();
}
/// Feature: Contrast op
/// Description: Test Contrast op with invalid enhancement_amount
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestContrastParamCheck) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestContrastParamCheck.";
std::shared_ptr<SchemaObj> schema = Schema();
@ -783,6 +855,9 @@ TEST_F(MindDataTestPipeline, TestContrastParamCheck) {
EXPECT_EQ(iter02, nullptr);
}
/// Feature: DeemphBiquad op
/// Description: Test DeemphBiquad op basic usage in pipeline mode
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestDeemphBiquadPipeline) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestDeemphBiquadPipeline.";
// Original waveform
@ -822,6 +897,9 @@ TEST_F(MindDataTestPipeline, TestDeemphBiquadPipeline) {
iter->Stop();
}
/// Feature: DeemphBiquad op
/// Description: Test DeemphBiquad op with invalid sample_rate and Q_
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestDeemphBiquadWrongArgs) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestDeemphBiquadWrongArgs.";
std::shared_ptr<SchemaObj> schema = Schema();
@ -841,9 +919,9 @@ TEST_F(MindDataTestPipeline, TestDeemphBiquadWrongArgs) {
EXPECT_EQ(iter01, nullptr);
}
/// Feature: Dither
/// Description: test basic usage of Dither in pipeline mode
/// Expectation: the data is processed successfully
/// Feature: Dither op
/// Description: Test basic usage of Dither op in pipeline mode
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestDitherBasic) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestDitherBasic.";
// Original waveform
@ -881,6 +959,9 @@ TEST_F(MindDataTestPipeline, TestDitherBasic) {
iter->Stop();
}
/// Feature: HighpassBiquad op
/// Description: Test HighpassBiquad op basic usage
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestHighpassBiquadSuccess) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestHighpassBiquadSuccess.";
@ -891,7 +972,7 @@ TEST_F(MindDataTestPipeline, TestHighpassBiquadSuccess) {
EXPECT_NE(ds, nullptr);
// Create a filter object
std::shared_ptr<TensorTransform> highpass_biquad(new audio::HighpassBiquad(44100, 3000.5, 0.707));
auto highpass_biquad = make_shared<audio::HighpassBiquad>(44100, 3000.5, 0.707);
auto ds1 = ds->Map({highpass_biquad}, {"col1"}, {"audio"});
EXPECT_NE(ds1, nullptr);
std::shared_ptr<Iterator> iter = ds1->CreateIterator();
@ -907,6 +988,9 @@ TEST_F(MindDataTestPipeline, TestHighpassBiquadSuccess) {
iter->Stop();
}
/// Feature: HighpassBiquad op
/// Description: Test HighpassBiquad op with invalid sample_rate and Q_
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestHighpassBiquadWrongArgs) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestHighpassBiquadWrongArgs.";
std::shared_ptr<SchemaObj> schema = Schema();
@ -936,9 +1020,9 @@ TEST_F(MindDataTestPipeline, TestHighpassBiquadWrongArgs) {
EXPECT_EQ(iter02, nullptr);
}
/// Feature: InverseMelScale
/// Description: test basic usage of InverseMelScale
/// Expectation: get correct number of data
/// Feature: InverseMelScale op
/// Description: Test basic usage of InverseMelScale op
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestInverseMelScalePipeline) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestInverseMelScalePipeline.";
// Original waveform
@ -1040,9 +1124,9 @@ TEST_F(MindDataTestPipeline, TestInverseMelScalePipeline) {
iter->Stop();
}
/// Feature: InverseMelScale
/// Description: test WrongArg of InverseMelScale
/// Expectation: return error
/// Feature: InverseMelScale op
/// Description: Test wrong arguments for InverseMelScale op
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestInverseMelScaleWrongArgs) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestInverseMelScaleWrongArgs.";
// MelScale: f_max must be greater than f_min.
@ -1094,9 +1178,9 @@ TEST_F(MindDataTestPipeline, TestInverseMelScaleWrongArgs) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: MelscaleFbanks.
/// Description: Test normal operation.
/// Expectation: As expected.
/// Feature: MelscaleFbanks op
/// Description: Test normal operation
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestMelscaleFbanksNormal) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-MelscaleFbanksNormal.";
mindspore::MSTensor output;
@ -1106,6 +1190,9 @@ TEST_F(MindDataTestPipeline, TestMelscaleFbanksNormal) {
EXPECT_TRUE(s01.IsOk());
}
/// Feature: MuLawDecoding op
/// Description: Test MuLawDecoding op basic usage
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestMuLawDecodingBasic) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestMuLawDecodingBasic.";
@ -1145,6 +1232,9 @@ TEST_F(MindDataTestPipeline, TestMuLawDecodingBasic) {
iter->Stop();
}
/// Feature: MuLawDecoding op
/// Description: Test MuLawDecoding op with invalid quantization_channels
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestMuLawDecodingWrongArgs) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestMuLawDecodingWrongArgs.";
@ -1172,9 +1262,9 @@ TEST_F(MindDataTestPipeline, TestMuLawDecodingWrongArgs) {
EXPECT_EQ(iter1, nullptr);
}
/// Feature: MuLawEncoding
/// Description: test MuLawEncoding in pipeline mode
/// Expectation: the data is processed successfully
/// Feature: MuLawEncoding op
/// Description: Test MuLawEncoding op in pipeline mode
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestMuLawEncodingBasic) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestMuLawEncodingBasic.";
@ -1214,9 +1304,9 @@ TEST_F(MindDataTestPipeline, TestMuLawEncodingBasic) {
iter->Stop();
}
/// Feature: MuLawEncoding
/// Description: test invalid parameter of MuLawEncoding
/// Expectation: throw exception correctly
/// Feature: MuLawEncoding op
/// Description: Test invalid parameter of MuLawEncoding op
/// Expectation: Throw exception correctly
TEST_F(MindDataTestPipeline, TestMuLawEncodingWrongArgs) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestMuLawEncodingWrongArgs.";
@ -1244,9 +1334,9 @@ TEST_F(MindDataTestPipeline, TestMuLawEncodingWrongArgs) {
EXPECT_EQ(iter1, nullptr);
}
/// Feature: Overdrive
/// Description: test basic usage of Overdrive
/// Expectation: get correct number of data
/// Feature: Overdrive op
/// Description: Test basic usage of Overdrive op
/// Expectation: Get correct number of data
TEST_F(MindDataTestPipeline, TestOverdriveBasic) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestOverdriveBasic.";
// Original waveform
@ -1285,9 +1375,9 @@ TEST_F(MindDataTestPipeline, TestOverdriveBasic) {
iter->Stop();
}
/// Feature: Overdrive
/// Description: test invalid parameter of Overdrive
/// Expectation: throw exception correctly
/// Feature: Overdrive op
/// Description: Test invalid parameter of Overdrive op
/// Expectation: Throw exception correctly
TEST_F(MindDataTestPipeline, TestOverdriveWrongArg) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestOverdriveWrongArg.";
std::shared_ptr<SchemaObj> schema = Schema();
@ -1315,9 +1405,9 @@ TEST_F(MindDataTestPipeline, TestOverdriveWrongArg) {
EXPECT_EQ(iter02, nullptr);
}
/// Feature: Phaser
/// Description: test basic usage of Phaser
/// Expectation: get correct number of data
/// Feature: Phaser op
/// Description: Test basic usage of Phaser op
/// Expectation: Get correct number of data
TEST_F(MindDataTestPipeline, TestPhaserBasic) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestPhaserBasic";
// Original waveform
@ -1356,9 +1446,9 @@ TEST_F(MindDataTestPipeline, TestPhaserBasic) {
iter->Stop();
}
/// Feature: Phaser
/// Description: test invalid parameter of Phaser
/// Expectation: throw exception correctly
/// Feature: Phaser op
/// Description: Test invalid parameter of Phaser op
/// Expectation: Throw exception correctly
TEST_F(MindDataTestPipeline, TestPhaserWrongArg) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestPhaserWrongArg.";
std::shared_ptr<SchemaObj> schema = Schema();
@ -1453,6 +1543,9 @@ TEST_F(MindDataTestPipeline, TestPhaserWrongArg) {
EXPECT_EQ(iter10, nullptr);
}
/// Feature: LFilter op
/// Description: Test LFilter op with pipeline mode
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestLfilterPipeline) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestLfilterPipeline.";
// Original waveform
@ -1494,6 +1587,9 @@ TEST_F(MindDataTestPipeline, TestLfilterPipeline) {
iter->Stop();
}
/// Feature: LFilter op
/// Description: Test LFilter op with invalid sample_rate
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestLfilterWrongArgs) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestLfilterWrongArgs.";
std::shared_ptr<SchemaObj> schema = Schema();
@ -1515,6 +1611,9 @@ TEST_F(MindDataTestPipeline, TestLfilterWrongArgs) {
EXPECT_EQ(iter01, nullptr);
}
/// Feature: DCShift op
/// Description: Test DCShift op with pipeline mode
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestDCShiftPipeline) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestDCShiftPipeline.";
@ -1550,6 +1649,9 @@ TEST_F(MindDataTestPipeline, TestDCShiftPipeline) {
iter->Stop();
}
/// Feature: DCShift op
/// Description: Test DCShift op with pipeline mode with invalid input
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestDCShiftPipelineError) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestDCShiftPipelineError.";
std::shared_ptr<SchemaObj> schema = Schema();
@ -1566,6 +1668,9 @@ TEST_F(MindDataTestPipeline, TestDCShiftPipelineError) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: Biquad op
/// Description: Test Biquad op basic usage
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestBiquadBasic) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestBiquadBasic.";
// Original waveform
@ -1605,6 +1710,9 @@ TEST_F(MindDataTestPipeline, TestBiquadBasic) {
iter->Stop();
}
/// Feature: Biquad op
/// Description: Test Biquad op with invalid a0
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestBiquadParamCheck) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestBiquadParamCheck.";
std::shared_ptr<SchemaObj> schema = Schema();
@ -1624,6 +1732,9 @@ TEST_F(MindDataTestPipeline, TestBiquadParamCheck) {
EXPECT_EQ(iter01, nullptr);
}
/// Feature: Fade op
/// Description: Test Fade op with pipeline mode
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestFadeWithPipeline) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestFadeWithPipeline.";
std::shared_ptr<SchemaObj> schema = Schema();
@ -1661,6 +1772,9 @@ TEST_F(MindDataTestPipeline, TestFadeWithPipeline) {
iter->Stop();
}
/// Feature: Fade op
/// Description: Test Fade op with FadeShape::kLinear
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestFadeWithLinear) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestFadeWithLinear.";
std::shared_ptr<SchemaObj> schema = Schema();
@ -1698,6 +1812,9 @@ TEST_F(MindDataTestPipeline, TestFadeWithLinear) {
iter->Stop();
}
/// Feature: Fade op
/// Description: Test Fade op with FadeShape::kLogarithmic
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestFadeWithLogarithmic) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestFadeWithLogarithmic.";
std::shared_ptr<SchemaObj> schema = Schema();
@ -1735,6 +1852,9 @@ TEST_F(MindDataTestPipeline, TestFadeWithLogarithmic) {
iter->Stop();
}
/// Feature: Fade op
/// Description: Test Fade op with FadeShape::kQuarterSine
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestFadeWithQuarterSine) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestFadeWithQuarterSine.";
std::shared_ptr<SchemaObj> schema = Schema();
@ -1772,6 +1892,9 @@ TEST_F(MindDataTestPipeline, TestFadeWithQuarterSine) {
iter->Stop();
}
/// Feature: Fade op
/// Description: Test Fade op with FadeShape::kHalfSine
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestFadeWithHalfSine) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestFadeWithHalfSine.";
std::shared_ptr<SchemaObj> schema = Schema();
@ -1809,6 +1932,9 @@ TEST_F(MindDataTestPipeline, TestFadeWithHalfSine) {
iter->Stop();
}
/// Feature: Fade op
/// Description: Test Fade op with invalid arguments
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestFadeWithInvalidArg) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestFadeWithInvalidArg.";
std::shared_ptr<SchemaObj> schema = Schema();
@ -1842,6 +1968,9 @@ TEST_F(MindDataTestPipeline, TestFadeWithInvalidArg) {
EXPECT_EQ(iter_02, nullptr);
}
/// Feature: Magphase op
/// Description: Test Magphase op basic usage
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestMagphase) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestMagphase.";
@ -1850,7 +1979,7 @@ TEST_F(MindDataTestPipeline, TestMagphase) {
ASSERT_OK(schema->add_column("col1", mindspore::DataType::kNumberTypeFloat32, {1, 2}));
std::shared_ptr<Dataset> ds = RandomData(8, schema);
EXPECT_NE(ds, nullptr);
std::shared_ptr<TensorTransform> magphase(new audio::Magphase(power));
auto magphase = std::make_shared<audio::Magphase>(power);
auto ds1 = ds->Map({magphase}, {"col1"}, {"mag", "phase"});
EXPECT_NE(ds1, nullptr);
std::shared_ptr<Iterator> iter = ds1->CreateIterator();
@ -1866,11 +1995,14 @@ TEST_F(MindDataTestPipeline, TestMagphase) {
iter->Stop();
}
/// Feature: Magphase op
/// Description: Test Magphase op with invalid power
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestMagphaseWrongArgs) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestMagphaseWrongArgs.";
float power_wrong = -1.0;
std::shared_ptr<TensorTransform> magphase(new audio::Magphase(power_wrong));
auto magphase = std::make_shared<audio::Magphase>(power_wrong);
std::unordered_map<std::string, mindspore::MSTensor> row;
// Magphase: power must be greater than or equal to 0.
@ -1884,6 +2016,9 @@ TEST_F(MindDataTestPipeline, TestMagphaseWrongArgs) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: DetectPitchFrequency op
/// Description: Test DetectPitchFrequency op basic usage
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestDetectPitchFrequencyBasic) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestDetectPitchFrequencyBasic.";
// Original waveform
@ -1922,6 +2057,9 @@ TEST_F(MindDataTestPipeline, TestDetectPitchFrequencyBasic) {
iter->Stop();
}
/// Feature: DetectPitchFrequency op
/// Description: Test DetectPitchFrequency op with invalid parameters
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestDetectPitchFrequencyParamCheck) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestDetectPitchFrequencyParamCheck.";
std::shared_ptr<SchemaObj> schema = Schema();
@ -1981,6 +2119,9 @@ TEST_F(MindDataTestPipeline, TestDetectPitchFrequencyParamCheck) {
EXPECT_EQ(iter05, nullptr);
}
/// Feature: Flanger op
/// Description: Test Flanger op basic usage
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestFlangerBasic) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestFlangerBasic.";
// Original waveform
@ -2018,6 +2159,9 @@ TEST_F(MindDataTestPipeline, TestFlangerBasic) {
iter->Stop();
}
/// Feature: Flanger op
/// Description: Test Flanger op with invalid parameters
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestFlangerParamCheck) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestFlangerParamCheck.";
std::shared_ptr<SchemaObj> schema = Schema();
@ -2090,9 +2234,9 @@ TEST_F(MindDataTestPipeline, TestFlangerParamCheck) {
EXPECT_EQ(iterPhase, nullptr);
}
/// Feature: CreateDct
/// Description: test CreateDct in eager mode
/// Expectation: the returned result is as expected
/// Feature: CreateDct op
/// Description: Test CreateDct op in eager mode with NormMode::kNone
/// Expectation: The returned result is as expected
TEST_F(MindDataTestPipeline, TestCreateDctNone) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCreateDctNone.";
mindspore::MSTensor output;
@ -2100,9 +2244,9 @@ TEST_F(MindDataTestPipeline, TestCreateDctNone) {
EXPECT_TRUE(s01.IsOk());
}
/// Feature: CreateDct
/// Description: test CreateDct in eager mode
/// Expectation: the returned result is as expected
/// Feature: CreateDct op
/// Description: Test CreateDct op in eager mode with NormMode::kOrtho
/// Expectation: The returned result is as expected
TEST_F(MindDataTestPipeline, TestCreateDctOrtho) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCreateDctOrtho.";
mindspore::MSTensor output;
@ -2110,9 +2254,9 @@ TEST_F(MindDataTestPipeline, TestCreateDctOrtho) {
EXPECT_TRUE(s02.IsOk());
}
/// Feature: CreateDct
/// Description: test WrongArg of CreateDct
/// Expectation: return error
/// Feature: CreateDct op
/// Description: Test wrong arguments for CreateDct op
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestCreateDctWrongArg) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCreateDctWrongArg.";
mindspore::MSTensor output;
@ -2126,9 +2270,9 @@ TEST_F(MindDataTestPipeline, TestCreateDctWrongArg) {
EXPECT_FALSE(s04.IsOk());
}
/// Feature: DBToAmplitude
/// Description: test DBToAmplitude in pipeline mode
/// Expectation: the data is processed successfully
/// Feature: DBToAmplitude op
/// Description: Test DBToAmplitude op in pipeline mode
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestDBToAmplitudePipeline) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestDBToAmplitudePipeline.";
// Original waveform
@ -2167,9 +2311,9 @@ TEST_F(MindDataTestPipeline, TestDBToAmplitudePipeline) {
iter->Stop();
}
/// Feature: ComputeDeltas
/// Description: test basic function of ComputeDeltas
/// Expectation: get correct number of data
/// Feature: ComputeDeltas op
/// Description: Test basic function of ComputeDeltas op
/// Expectation: Get correct number of data
TEST_F(MindDataTestPipeline, TestComputeDeltas) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestComputeDeltas.";
// Original waveform
@ -2208,9 +2352,9 @@ TEST_F(MindDataTestPipeline, TestComputeDeltas) {
iter->Stop();
}
/// Feature: ComputeDeltas
/// Description: test wrong input args of ComputeDeltas
/// Expectation: get nullptr of iterator
/// Feature: ComputeDeltas op
/// Description: Test wrong input args of ComputeDeltas op
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestComputeDeltasWrongArgs) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestComputeDeltasWrongArgs.";
// Original waveform
@ -2230,9 +2374,9 @@ TEST_F(MindDataTestPipeline, TestComputeDeltasWrongArgs) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: Gain
/// Description: test Gain in pipeline mode
/// Expectation: the data is processed successfully
/// Feature: Gain op
/// Description: Test Gain op in pipeline mode
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestGainPipeline) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestGainPipeline.";
// Original waveform
@ -2272,9 +2416,9 @@ TEST_F(MindDataTestPipeline, TestGainPipeline) {
iter->Stop();
}
/// Feature: MelScale
/// Description: test basic usage of MelScale
/// Expectation: get correct number of data
/// Feature: MelScale op
/// Description: Test basic usage of MelScale op
/// Expectation: Get correct number of data
TEST_F(MindDataTestPipeline, TestMelScalePipeline) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestMelScalePipeline.";
// Original waveform
@ -2354,9 +2498,9 @@ TEST_F(MindDataTestPipeline, TestMelScalePipeline) {
iter->Stop();
}
/// Feature: MelScale
/// Description: test WrongArg of MelScale
/// Expectation: return error
/// Feature: MelScale op
/// Description: Test wrong arguments for MelScale op
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestMelScaleWrongArgs) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestMelScaleWrongArgs.";
@ -2388,9 +2532,9 @@ TEST_F(MindDataTestPipeline, TestMelScaleWrongArgs) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: PhaseVocoder
/// Description: test PhaseVocoder in pipeline mode
/// Expectation: the data is processed successfully
/// Feature: PhaseVocoder op
/// Description: Test PhaseVocoder op in pipeline mode
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestPhaseVocoderPipeline) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestPhaseVocoderPipeline.";
std::shared_ptr<SchemaObj> schema = Schema();
@ -2445,9 +2589,9 @@ TEST_F(MindDataTestPipeline, TestPhaseVocoderPipeline) {
iter->Stop();
}
/// Feature: PhaseVocoder
/// Description: test PhaseVocoder with wrong input
/// Expectation: Throw exception as expected.
/// Feature: PhaseVocoder op
/// Description: Test PhaseVocoder op with wrong input
/// Expectation: Throw exception as expected
TEST_F(MindDataTestPipeline, TestPhaseVocoderWrongArgs) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestPhaseVocoderWrongArgs.";
std::shared_ptr<SchemaObj> schema = Schema();
@ -2484,9 +2628,9 @@ TEST_F(MindDataTestPipeline, TestPhaseVocoderWrongArgs) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: MaskAlongAxisIID
/// Description: test MaskAlongAxisIID pipeline
/// Expectation: the returned result is as expected
/// Feature: MaskAlongAxisIID op
/// Description: Test MaskAlongAxisIID op pipeline
/// Expectation: The returned result is as expected
TEST_F(MindDataTestPipeline, TestMaskAlongAxisIIDPipeline) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestMaskAlongAxisIIDPipeline.";
std::shared_ptr<SchemaObj> schema = Schema();
@ -2530,9 +2674,9 @@ TEST_F(MindDataTestPipeline, TestMaskAlongAxisIIDPipeline) {
iter->Stop();
}
/// Feature: MaskAlongAxisIID
/// Description: test MaskAlongAxisIID wrong args
/// Expectation: the returned result is as expected
/// Feature: MaskAlongAxisIID op
/// Description: Test MaskAlongAxisIID op with invalid mask_param
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestMaskAlongAxisIIDInvalidMaskParam) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestMaskAlongAxisIIDInvalidMaskParam.";
std::shared_ptr<SchemaObj> schema = Schema();
@ -2559,9 +2703,9 @@ TEST_F(MindDataTestPipeline, TestMaskAlongAxisIIDInvalidMaskParam) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: MaskAlongAxisIID
/// Description: test MaskAlongAxisIID wrong axis
/// Expectation: the returned result is as expected
/// Feature: MaskAlongAxisIID op
/// Description: Test MaskAlongAxisIID op with wrong axis
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestMaskAlongAxisIIDInvaildAxis) {
MS_LOG(INFO) << "MindDataTestPipeline-TestMaskAlongAxisIIDInvaildAxis.";
std::shared_ptr<SchemaObj> schema = Schema();
@ -2588,9 +2732,9 @@ TEST_F(MindDataTestPipeline, TestMaskAlongAxisIIDInvaildAxis) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: MaskAlongAxis
/// Description: test MaskAlongAxis Pipeline
/// Expectation: the returned result is as expected
/// Feature: MaskAlongAxis op
/// Description: Test MaskAlongAxis op in pipeline mode
/// Expectation: The returned result is as expected
TEST_F(MindDataTestPipeline, TestMaskAlongAxisPipeline) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestMaskAlongAxisPipeline.";
std::shared_ptr<SchemaObj> schema = Schema();
@ -2635,9 +2779,9 @@ TEST_F(MindDataTestPipeline, TestMaskAlongAxisPipeline) {
iter->Stop();
}
/// Feature: MaskAlongAxis
/// Description: test MaskAlongAxis wrong args
/// Expectation: the returned result is as expected
/// Feature: MaskAlongAxis op
/// Description: Test MaskAlongAxis op with invalid mask_param
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestMaskAlongAxisWrongArgs) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestMaskAlongAxisWrongArgs.";
std::shared_ptr<SchemaObj> schema = Schema();
@ -2665,9 +2809,9 @@ TEST_F(MindDataTestPipeline, TestMaskAlongAxisWrongArgs) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: MaskAlongAxis
/// Description: test MaskAlongAxis wrong mask_width
/// Expectation: the returned result is as expected
/// Feature: MaskAlongAxis op
/// Description: Test MaskAlongAxis op with wrong mask_width
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestMaskAlongAxisNegativeMaskWidth) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestMaskAlongAxisNegativeMaskWidth.";
std::shared_ptr<SchemaObj> schema = Schema();
@ -2695,9 +2839,9 @@ TEST_F(MindDataTestPipeline, TestMaskAlongAxisNegativeMaskWidth) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: MaskAlongAxis
/// Description: test MaskAlongAxis wrong axis
/// Expectation: the returned result is as expected
/// Feature: MaskAlongAxis op
/// Description: Test MaskAlongAxis op with wrong axis
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestMaskAlongAxisInvaildAxis) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestMaskAlongAxisInvaildAxis.";
std::shared_ptr<SchemaObj> schema = Schema();
@ -2725,9 +2869,9 @@ TEST_F(MindDataTestPipeline, TestMaskAlongAxisInvaildAxis) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: MaskAlongAxis
/// Description: test MaskAlongAxis wrong axis rank
/// Expectation: the returned result is as expected
/// Feature: MaskAlongAxis op
/// Description: Test MaskAlongAxis op with wrong axis rank
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestMaskAlongAxisRank) {
MS_LOG(INFO) << "Doing TestMaskAlongAxis-TestMaskAlongAxisRank.";
std::shared_ptr<SchemaObj> schema = Schema();

View File

@ -1,5 +1,5 @@
/**
* Copyright 2021 Huawei Technologies Co., Ltd
* Copyright 2021-2022 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -28,6 +28,9 @@ class MindDataTestPipeline : public UT::DatasetOpTesting {
protected:
};
/// Feature: RiaaBiquad op
/// Description: Test RiaaBiquad op basic usage with sample rate 44100
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestRiaaBiquadBasicSampleRate44100) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRiaaBiquadBasicSampleRate44100.";
// Original waveform
@ -67,6 +70,9 @@ TEST_F(MindDataTestPipeline, TestRiaaBiquadBasicSampleRate44100) {
iter->Stop();
}
/// Feature: RiaaBiquad op
/// Description: Test RiaaBiquad op basic usage with sample rate 48000
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestRiaaBiquadBasicSampleRate48000) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRiaaBiquadBasicSampleRate48000.";
// Original waveform
@ -106,6 +112,9 @@ TEST_F(MindDataTestPipeline, TestRiaaBiquadBasicSampleRate48000) {
iter->Stop();
}
/// Feature: RiaaBiquad op
/// Description: Test RiaaBiquad op basic usage with sample rate 88200
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestRiaaBiquadBasicSampleRate88200) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRiaaBiquadBasicSampleRate88200.";
// Original waveform
@ -145,6 +154,9 @@ TEST_F(MindDataTestPipeline, TestRiaaBiquadBasicSampleRate88200) {
iter->Stop();
}
/// Feature: RiaaBiquad op
/// Description: Test RiaaBiquad op basic usage with sample rate 96000
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestRiaaBiquadBasicSampleRate96000) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRiaaBiquadBasicSampleRate96000.";
// Original waveform
@ -184,6 +196,9 @@ TEST_F(MindDataTestPipeline, TestRiaaBiquadBasicSampleRate96000) {
iter->Stop();
}
/// Feature: RiaaBiquad op
/// Description: Test RiaaBiquad op basic usage with invalid sample_rate=0
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestRiaaBiquadWrongArg) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRiaaBiquadWrongArg.";
std::shared_ptr<SchemaObj> schema = Schema();
@ -203,9 +218,9 @@ TEST_F(MindDataTestPipeline, TestRiaaBiquadWrongArg) {
EXPECT_EQ(iter01, nullptr);
}
/// Feature: SlidingWindowCmn
/// Description: test basic function of SlidingWindowCmn
/// Expectation: get correct number of data
/// Feature: SlidingWindowCmn op
/// Description: Test basic function of SlidingWindowCmn op
/// Expectation: Get correct number of data
TEST_F(MindDataTestPipeline, TestSlidingWindowCmn) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSlidingWindowCmn.";
@ -229,9 +244,9 @@ TEST_F(MindDataTestPipeline, TestSlidingWindowCmn) {
iter->Stop();
}
/// Feature: SlidingWindowCmn
/// Description: test wrong input args of SlidingWindowCmn
/// Expectation: get nullptr of iterator
/// Feature: SlidingWindowCmn op
/// Description: Test wrong input args of SlidingWindowCmn op
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestSlidingWindowCmnWrongArgs) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSlidingWindowCmnWrongArgs.";
@ -255,9 +270,9 @@ TEST_F(MindDataTestPipeline, TestSlidingWindowCmnWrongArgs) {
EXPECT_EQ(iter_2, nullptr);
}
/// Feature: SpectralCentroid.
/// Description: test pipeline.
/// Expectation: success.
/// Feature: SpectralCentroid op
/// Description: Test SpectralCentroid op basic usage
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestSpectralCentroidBasic) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSpectralCentroidBasic.";
@ -286,9 +301,9 @@ TEST_F(MindDataTestPipeline, TestSpectralCentroidBasic) {
iter->Stop();
}
/// Feature: SpectralCentroid.
/// Description: test pipeline.
/// Expectation: success.
/// Feature: SpectralCentroid op
/// Description: Test SpectralCentroid op with default inputs
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestSpectralCentroidDefault) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSpectralCentroidDefault.";
@ -317,9 +332,9 @@ TEST_F(MindDataTestPipeline, TestSpectralCentroidDefault) {
iter->Stop();
}
/// Feature: SpectralCentroid.
/// Description: test some invalid parameters.
/// Expectation: success.
/// Feature: SpectralCentroid op
/// Description: Test SpectralCentroid op with invalid arguments
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestSpectralCentroidWrongArgs) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSpectralCentroidWrongArgs.";
@ -380,9 +395,9 @@ TEST_F(MindDataTestPipeline, TestSpectralCentroidWrongArgs) {
EXPECT_EQ(iter05, nullptr);
}
/// Feature: Spectrogram.
/// Description: test pipeline.
/// Expectation: success.
/// Feature: Spectrogram op
/// Description: Test Spectrogram op with default inputs
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestSpectrogramDefault) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSpectrogramDefault.";
@ -412,9 +427,9 @@ TEST_F(MindDataTestPipeline, TestSpectrogramDefault) {
iter->Stop();
}
/// Feature: Spectrogram.
/// Description: test parameter: onesided.
/// Expectation: success.
/// Feature: Spectrogram op
/// Description: Test Spectrogram op with onesided parameter to be false
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestSpectrogramOnesidedFalse) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSpectrogramOnesidedFalse.";
@ -444,9 +459,9 @@ TEST_F(MindDataTestPipeline, TestSpectrogramOnesidedFalse) {
iter->Stop();
}
/// Feature: Spectrogram.
/// Description: test parameter: center.
/// Expectation: success.
/// Feature: Spectrogram op
/// Description: Test Spectrogram op with center parameter to be false
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestSpectrogramCenterFalse) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSpectrogramCenterFalse.";
@ -476,9 +491,9 @@ TEST_F(MindDataTestPipeline, TestSpectrogramCenterFalse) {
iter->Stop();
}
/// Feature: Spectrogram.
/// Description: test parameter: normaliezd.
/// Expectation: success.
/// Feature: Spectrogram op
/// Description: Test Spectrogram op with normalized parameter to be true
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestSpectrogramNormalizedTrue) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSpectrogramNormalizedTrue.";
@ -508,9 +523,9 @@ TEST_F(MindDataTestPipeline, TestSpectrogramNormalizedTrue) {
iter->Stop();
}
/// Feature: Spectrogram.
/// Description: test parameter: window.
/// Expectation: success.
/// Feature: Spectrogram op
/// Description: Test Spectrogram op with WindowType::kHamming
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestSpectrogramWindowHamming) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSpectrogramWindowHamming.";
@ -540,9 +555,9 @@ TEST_F(MindDataTestPipeline, TestSpectrogramWindowHamming) {
iter->Stop();
}
/// Feature: Spectrogram.
/// Description: test parameter: pad_mode.
/// Expectation: success.
/// Feature: Spectrogram op
/// Description: Test Spectrogram op with BorderType::kEdge
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestSpectrogramPadmodeEdge) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSpectrogramPadmodeEdge.";
@ -572,9 +587,9 @@ TEST_F(MindDataTestPipeline, TestSpectrogramPadmodeEdge) {
iter->Stop();
}
/// Feature: Spectrogram.
/// Description: test parameter: power.
/// Expectation: success.
/// Feature: Spectrogram op
/// Description: Test Spectrogram op with power parameter to be 0
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestSpectrogramPower0) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSpectrogramPower0.";
@ -604,9 +619,9 @@ TEST_F(MindDataTestPipeline, TestSpectrogramPower0) {
iter->Stop();
}
/// Feature: Spectrogram.
/// Description: test parameter: n_fft.
/// Expectation: success.
/// Feature: Spectrogram op
/// Description: Test Spectrogram op with n_fft parameter to be 50
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestSpectrogramNfft50) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSpectrogramNfft600.";
@ -636,9 +651,9 @@ TEST_F(MindDataTestPipeline, TestSpectrogramNfft50) {
iter->Stop();
}
/// Feature: Spectrogram.
/// Description: test parameter: pad.
/// Expectation: success.
/// Feature: Spectrogram op
/// Description: Test Spectrogram op with pad parameter to be 10
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestSpectrogramPad10) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSpectrogramPad50.";
@ -668,9 +683,9 @@ TEST_F(MindDataTestPipeline, TestSpectrogramPad10) {
iter->Stop();
}
/// Feature: Spectrogram.
/// Description: test parameter: win_length.
/// Expectation: success.
/// Feature: Spectrogram op
/// Description: Test Spectrogram op with win_length parameter to be 30
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestSpectrogramWinlength30) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSpectrogramWinlength300.";
@ -700,9 +715,9 @@ TEST_F(MindDataTestPipeline, TestSpectrogramWinlength30) {
iter->Stop();
}
/// Feature: Spectrogram.
/// Description: test parameters.
/// Expectation: success.
/// Feature: Spectrogram op
/// Description: Test Spectrogram op with hop_length parameter to be 30
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestSpectrogramHoplength30) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSpectrogramHoplength300.";
@ -732,9 +747,9 @@ TEST_F(MindDataTestPipeline, TestSpectrogramHoplength30) {
iter->Stop();
}
/// Feature: Spectrogram.
/// Description: test some invalid parameters.
/// Expectation: success.
/// Feature: Spectrogram op
/// Description: Test Spectrogram op with invalid parameters
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestSpectrogramWrongArgs) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSpectrogramWrongArgs.";
@ -811,6 +826,9 @@ TEST_F(MindDataTestPipeline, TestSpectrogramWrongArgs) {
EXPECT_EQ(iter06, nullptr);
}
/// Feature: TimeMasking op
/// Description: Test TimeMasking op with pipeline mode
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestTimeMaskingPipeline) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestTimeMaskingPipeline.";
// Original waveform
@ -850,6 +868,9 @@ TEST_F(MindDataTestPipeline, TestTimeMaskingPipeline) {
iter->Stop();
}
/// Feature: TimeMasking op
/// Description: Test TimeMasking op with wrong arguments
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestTimeMaskingWrongArgs) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestTimeMaskingWrongArgs.";
// Original waveform
@ -871,6 +892,9 @@ TEST_F(MindDataTestPipeline, TestTimeMaskingWrongArgs) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: TimeStretch op
/// Description: Test TimeStretch op with pipeline mode
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestTimeStretchPipeline) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestTimeStretchPipeline.";
// op param
@ -913,6 +937,9 @@ TEST_F(MindDataTestPipeline, TestTimeStretchPipeline) {
iter->Stop();
}
/// Feature: TimeStretch op
/// Description: Test TimeStretch op with pipeline mode with wrong arguments
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestTimeStretchPipelineWrongArgs) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestTimeStretchPipelineWrongArgs.";
// op param
@ -939,6 +966,9 @@ TEST_F(MindDataTestPipeline, TestTimeStretchPipelineWrongArgs) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: TrebleBiquad op
/// Description: Test TrebleBiquad op basic usage
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestTrebleBiquadBasic) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestTrebleBiquadBasic.";
// Original waveform
@ -978,6 +1008,9 @@ TEST_F(MindDataTestPipeline, TestTrebleBiquadBasic) {
iter->Stop();
}
/// Feature: TrebleBiquad op
/// Description: Test TrebleBiquad op with invalid sample_rate and Q_
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestTrebleBiquadWrongArg) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestTrebleBiquadWrongArg.";
std::shared_ptr<SchemaObj> schema = Schema();
@ -1007,9 +1040,9 @@ TEST_F(MindDataTestPipeline, TestTrebleBiquadWrongArg) {
EXPECT_EQ(iter02, nullptr);
}
/// Feature: GriffinLim.
/// Description: test pipeline.
/// Expectation: success.
/// Feature: GriffinLim op
/// Description: Test GriffinLim op with pipeline mode
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestGriffinLimPipeline) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestGriffinLimPipeline.";
// Original waveform
@ -1067,9 +1100,9 @@ TEST_F(MindDataTestPipeline, TestGriffinLimPipeline) {
iter->Stop();
}
/// Feature: GriffinLim.
/// Description: test some invalid parameters.
/// Expectation: success.
/// Feature: GriffinLim op
/// Description: Test GriffinLim op with invalid parameters
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestGriffinLimWrongArgs) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestGriffinLimWrongArgs.";
// Original waveform
@ -1144,9 +1177,9 @@ TEST_F(MindDataTestPipeline, TestGriffinLimWrongArgs) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: Vad.
/// Description: test pipeline.
/// Expectation: success.
/// Feature: Vad op
/// Description: Test Vad op with pipeline mode
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestVadPipeline) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestVadPipeline.";
// Original waveform
@ -1204,9 +1237,9 @@ TEST_F(MindDataTestPipeline, TestVadPipeline) {
iter->Stop();
}
/// Feature: Vad.
/// Description: test some invalid parameters.
/// Expectation: success.
/// Feature: Vad op
/// Description: Test Vad op with invalid parameters
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestVadWrongArgs) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestVadWrongArgs.";
// Original waveform
@ -1347,6 +1380,9 @@ TEST_F(MindDataTestPipeline, TestVadWrongArgs) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: Vol op
/// Description: Test Vol op with pipeline mode
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestVolPipeline) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestVolPipeline.";
// Original waveform
@ -1385,6 +1421,9 @@ TEST_F(MindDataTestPipeline, TestVolPipeline) {
iter->Stop();
}
/// Feature: Vol op
/// Description: Test Vol op with wrong arguments
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestVolWrongArgs) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestVolWrongArgs.";
// Original waveform

View File

@ -1,5 +1,5 @@
/**
* Copyright 2020-2021 Huawei Technologies Co., Ltd
* Copyright 2020-2022 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -27,6 +27,9 @@ class MindDataTestCacheOp : public UT::DatasetOpTesting {
void SetUp() override { DatasetOpTesting::SetUp(); }
};
/// Feature: Cache
/// Description: Test Cache with null sampler on ImageFolderDataset
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestCacheOp, DISABLED_TestCacheCApiSamplerNull) {
session_id_type env_session;
Status s = GetSessionFromEnv(&env_session);
@ -47,6 +50,9 @@ TEST_F(MindDataTestCacheOp, DISABLED_TestCacheCApiSamplerNull) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: Cache
/// Description: Test Cache with Decode op on ImageFolderDataset
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestCacheOp, DISABLED_TestCacheCApiNestedCache) {
session_id_type env_session;
Status s = GetSessionFromEnv(&env_session);
@ -75,6 +81,9 @@ TEST_F(MindDataTestCacheOp, DISABLED_TestCacheCApiNestedCache) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: Cache
/// Description: Test Cache and Repeat on ImageFolderDataset, iterate through dataset and count rows
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestCacheOp, DISABLED_TestCacheImageFolderCApi) {
session_id_type env_session;
Status s = GetSessionFromEnv(&env_session);
@ -116,6 +125,9 @@ TEST_F(MindDataTestCacheOp, DISABLED_TestCacheImageFolderCApi) {
iter->Stop();
}
/// Feature: Cache
/// Description: Test Cache and Repeat on CocoDataset, iterate through dataset and count rows
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestCacheOp, DISABLED_TestCacheCocoCApi) {
session_id_type env_session;
Status s = GetSessionFromEnv(&env_session);
@ -159,6 +171,9 @@ TEST_F(MindDataTestCacheOp, DISABLED_TestCacheCocoCApi) {
iter->Stop();
}
/// Feature: Cache
/// Description: Test Cache and Repeat on MnistDataset, iterate through dataset and count rows
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestCacheOp, DISABLED_TestCacheMnistCApi) {
session_id_type env_session;
Status s = GetSessionFromEnv(&env_session);
@ -200,6 +215,9 @@ TEST_F(MindDataTestCacheOp, DISABLED_TestCacheMnistCApi) {
iter->Stop();
}
/// Feature: Cache
/// Description: Test Cache and Repeat on CelebADataset, iterate through dataset and count rows
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestCacheOp, DISABLED_TestCacheCelebaCApi) {
session_id_type env_session;
Status s = GetSessionFromEnv(&env_session);
@ -242,6 +260,9 @@ TEST_F(MindDataTestCacheOp, DISABLED_TestCacheCelebaCApi) {
iter->Stop();
}
/// Feature: Cache
/// Description: Test Cache and Repeat on ManifestDataset, iterate through dataset and count rows
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestCacheOp, DISABLED_TestCacheManifestCApi) {
session_id_type env_session;
Status s = GetSessionFromEnv(&env_session);
@ -283,6 +304,9 @@ TEST_F(MindDataTestCacheOp, DISABLED_TestCacheManifestCApi) {
iter->Stop();
}
/// Feature: Cache
/// Description: Test Cache and Repeat on Cifar10Dataset, iterate through dataset and count rows
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestCacheOp, DISABLED_TestCacheCifar10CApi) {
session_id_type env_session;
Status s = GetSessionFromEnv(&env_session);
@ -324,6 +348,9 @@ TEST_F(MindDataTestCacheOp, DISABLED_TestCacheCifar10CApi) {
iter->Stop();
}
/// Feature: Cache
/// Description: Test Cache and Repeat on Cifar100Dataset, iterate through dataset and count rows
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestCacheOp, DISABLED_TestCacheCifar100CApi) {
session_id_type env_session;
Status s = GetSessionFromEnv(&env_session);
@ -365,6 +392,9 @@ TEST_F(MindDataTestCacheOp, DISABLED_TestCacheCifar100CApi) {
iter->Stop();
}
/// Feature: Cache
/// Description: Test Cache and Repeat on VOCDataset, iterate through dataset and count rows
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestCacheOp, DISABLED_TestCacheVocCApi) {
session_id_type env_session;
Status s = GetSessionFromEnv(&env_session);
@ -407,6 +437,9 @@ TEST_F(MindDataTestCacheOp, DISABLED_TestCacheVocCApi) {
iter->Stop();
}
/// Feature: Cache
/// Description: Test Cache and Repeat on AlbumDataset, iterate through dataset and count rows
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestCacheOp, DISABLED_TestCacheAlbumCApi) {
session_id_type env_session;
Status s = GetSessionFromEnv(&env_session);
@ -449,6 +482,9 @@ TEST_F(MindDataTestCacheOp, DISABLED_TestCacheAlbumCApi) {
iter->Stop();
}
/// Feature: Cache
/// Description: Test Cache on MindRecordDataset, iterate through dataset and count rows
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestCacheOp, DISABLED_TestCacheMindRecordCApi) {
session_id_type env_session;
Status s = GetSessionFromEnv(&env_session);
@ -488,6 +524,9 @@ TEST_F(MindDataTestCacheOp, DISABLED_TestCacheMindRecordCApi) {
iter->Stop();
}
/// Feature: Cache
/// Description: Test Cache and Repeat on RandomDataDataset, iterate through dataset and count rows
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestCacheOp, DISABLED_TestCacheRandomDataCApi) {
session_id_type env_session;
Status s = GetSessionFromEnv(&env_session);
@ -530,6 +569,9 @@ TEST_F(MindDataTestCacheOp, DISABLED_TestCacheRandomDataCApi) {
iter->Stop();
}
/// Feature: Cache
/// Description: Test Cache and Repeat on TFRecordDataset, iterate through dataset and count rows
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestCacheOp, DISABLED_TestCacheTFRecordCApi1) {
session_id_type env_session;
Status s = GetSessionFromEnv(&env_session);
@ -573,6 +615,9 @@ TEST_F(MindDataTestCacheOp, DISABLED_TestCacheTFRecordCApi1) {
iter->Stop();
}
/// Feature: Cache
/// Description: Test Cache and Repeat on TFRecordDataset with sharding config, iterate through dataset and count rows
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestCacheOp, DISABLED_TestCacheTFRecordCApi2) {
session_id_type env_session;
Status s = GetSessionFromEnv(&env_session);
@ -624,6 +669,9 @@ TEST_F(MindDataTestCacheOp, DISABLED_TestCacheTFRecordCApi2) {
iter->Stop();
}
/// Feature: Cache
/// Description: Test Cache and Repeat on TFRecordDataset with num_samples, iterate through dataset and count rows
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestCacheOp, DISABLED_TestCacheTFRecordCApi3) {
session_id_type env_session;
Status s = GetSessionFromEnv(&env_session);
@ -671,6 +719,9 @@ TEST_F(MindDataTestCacheOp, DISABLED_TestCacheTFRecordCApi3) {
iter->Stop();
}
/// Feature: Cache
/// Description: Test Cache and Repeat on TextFileDataset, iterate through dataset and count rows
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestCacheOp, DISABLED_TestCacheTextfileCApi) {
session_id_type env_session;
Status s = GetSessionFromEnv(&env_session);
@ -714,6 +765,9 @@ TEST_F(MindDataTestCacheOp, DISABLED_TestCacheTextfileCApi) {
iter->Stop();
}
/// Feature: Cache
/// Description: Test Cache and Repeat on CSVDataset, iterate through dataset and count rows
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestCacheOp, DISABLED_TestCacheCsvCApi) {
session_id_type env_session;
Status s = GetSessionFromEnv(&env_session);
@ -758,6 +812,9 @@ TEST_F(MindDataTestCacheOp, DISABLED_TestCacheCsvCApi) {
iter->Stop();
}
/// Feature: Cache
/// Description: Test Cache and Repeat on CLUEDataset, iterate through dataset and count rows
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestCacheOp, DISABLED_TestCacheClueCApi) {
session_id_type env_session;
Status s = GetSessionFromEnv(&env_session);
@ -803,6 +860,9 @@ TEST_F(MindDataTestCacheOp, DISABLED_TestCacheClueCApi) {
iter->Stop();
}
/// Feature: Cache
/// Description: Test Cache share by having two datasets where both pipeline is ImageFolderDataset with RandomSampler
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestCacheOp, DISABLED_TestCApiCacheShare1) {
session_id_type env_session;
Status s = GetSessionFromEnv(&env_session);
@ -855,6 +915,10 @@ TEST_F(MindDataTestCacheOp, DISABLED_TestCApiCacheShare1) {
iter2->Stop();
}
/// Feature: Cache
/// Description: Test Cache share by having two datasets where first pipeline is ImageFolder with RandomSampler
/// and second pipeline is ImageFolder with SequentialSampler
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestCacheOp, DISABLED_TestCApiCacheShare2) {
session_id_type env_session;
Status s = GetSessionFromEnv(&env_session);
@ -908,6 +972,11 @@ TEST_F(MindDataTestCacheOp, DISABLED_TestCApiCacheShare2) {
iter2->Stop();
}
/// Feature: Cache
/// Description: Test Cache share by having two datasets where first pipeline is ImageFolder with decode flag set
/// to be true and second pipeline is ImageFolder with decode flag set to be false
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline,
/// returns nullptr for second pipeline
TEST_F(MindDataTestCacheOp, DISABLED_TestCApiCacheShareFailure1) {
session_id_type env_session;
Status s = GetSessionFromEnv(&env_session);
@ -947,7 +1016,7 @@ TEST_F(MindDataTestCacheOp, DISABLED_TestCApiCacheShareFailure1) {
// Feature: Test RandomData with Cache and Repeat
// Description: Iterate through dataset and count rows
// Expectation: There should be 200 rows in the dataset
// Expectation: There should be 200 rows in the dataset
TEST_F(MindDataTestCacheOp, DISABLED_TestCacheRandomDataCApi1) {
session_id_type env_session;
Status s = GetSessionFromEnv(&env_session);
@ -992,7 +1061,7 @@ TEST_F(MindDataTestCacheOp, DISABLED_TestCacheRandomDataCApi1) {
// Feature: Test RandomData with Cache and Repeat
// Description: Set mem_sz such that spill occurs, iterate through dataset and count rows
// Expectation: There should be 40 rows in the dataset
// Expectation: There should be 40 rows in the dataset
TEST_F(MindDataTestCacheOp, DISABLED_TestCacheRandomDataSpillCApi) {
session_id_type env_session;
Status s = GetSessionFromEnv(&env_session);

View File

@ -1,5 +1,5 @@
/**
* Copyright 2021 Huawei Technologies Co., Ltd
* Copyright 2021-2022 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -25,9 +25,9 @@ class MindDataTestPipeline : public UT::DatasetOpTesting {
protected:
};
/// Feature: Test AGNewsDataset Dataset.
/// Description: read AGNewsDataset data and get data.
/// Expectation: the data is processed successfully.
/// Feature: AGNewsDataset
/// Description: Basic test for AGNewsDataset
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestAGNewsDatasetBasic) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestAGNewsDatasetBasic.";
@ -74,9 +74,9 @@ TEST_F(MindDataTestPipeline, TestAGNewsDatasetBasic) {
iter->Stop();
}
/// Feature: Test AGNewsDataset Dataset.
/// Description: read AGNewsDataset data and get data.
/// Expectation: the data is processed successfully.
/// Feature: AGNewsDataset
/// Description: Test AGNewsDataset in pipeline mode
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestAGNewsGetters) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestAGNewsGetters.";
@ -100,9 +100,9 @@ TEST_F(MindDataTestPipeline, TestAGNewsGetters) {
EXPECT_EQ(ds->GetColumnNames(), column_names);
}
/// Feature: Test AGNewsDataset Dataset.
/// Description: read AGNewsDataset data and get data.
/// Expectation: the data is processed successfully.
/// Feature: AGNewsDataset
/// Description: Test AGNewsDataset with invalid inputs
/// Expectation: Correct error and message are thrown
TEST_F(MindDataTestPipeline, TestAGNewsDatasetFail) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestAGNewsDatasetFail.";
@ -148,9 +148,9 @@ TEST_F(MindDataTestPipeline, TestAGNewsDatasetFail) {
EXPECT_EQ(iter4, nullptr);
}
/// Feature: Test AGNewsDataset Dataset.
/// Description: read AGNewsDataset data and get data.
/// Expectation: the data is processed successfully.
/// Feature: AGNewsDataset
/// Description: Test AGNewsDataset with valid num_samples
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestAGNewsDatasetNumSamples) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestAGNewsDatasetNumSamples.";
@ -197,9 +197,9 @@ TEST_F(MindDataTestPipeline, TestAGNewsDatasetNumSamples) {
iter->Stop();
}
/// Feature: Test AGNewsDataset Dataset.
/// Description: read AGNewsDataset data and get data.
/// Expectation: the data is processed successfully.
/// Feature: AGNewsDataset
/// Description: Test distributed AGNewsDataset (with num_shards and shard_id)
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestAGNewsDatasetDistribution) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestAGNewsDatasetDistribution.";
@ -246,9 +246,9 @@ TEST_F(MindDataTestPipeline, TestAGNewsDatasetDistribution) {
iter->Stop();
}
/// Feature: Test AGNewsDataset Dataset.
/// Description: read AGNewsDataset data and get data.
/// Expectation: the data is processed successfully.
/// Feature: AGNewsDataset
/// Description: Test AGNewsDataset with all as usage
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestAGNewsDatasetMultiFiles) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestAGNewsDatasetMultiFiles.";
@ -304,9 +304,9 @@ TEST_F(MindDataTestPipeline, TestAGNewsDatasetMultiFiles) {
iter->Stop();
}
/// Feature: Test AGNewsDataset Dataset.
/// Description: read AGNewsDataset data and get data.
/// Expectation: the data is processed successfully.
/// Feature: AGNewsDataset
/// Description: Test AGNewsDataset header
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestAGNewsDatasetHeader) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestAGNewsDatasetHeader.";
@ -353,9 +353,9 @@ TEST_F(MindDataTestPipeline, TestAGNewsDatasetHeader) {
iter->Stop();
}
/// Feature: Test AGNewsDataset Dataset.
/// Description: read AGNewsDataset data and get data.
/// Expectation: the data is processed successfully.
/// Feature: AGNewsDataset
/// Description: Test AGNewsDataset using ShuffleMode::kFiles
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestAGNewsDatasetShuffleFilesA) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestAGNewsDatasetShuffleFilesA.";
@ -422,9 +422,9 @@ TEST_F(MindDataTestPipeline, TestAGNewsDatasetShuffleFilesA) {
original_num_parallel_workers);
}
/// Feature: Test AGNewsDataset Dataset.
/// Description: read AGNewsDataset data and get data.
/// Expectation: the data is processed successfully.
/// Feature: AGNewsDataset
/// Description: Test AGNewsDataset using ShuffleMode::kInfile
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestAGNewsDatasetShuffleFilesB) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestAGNewsDatasetShuffleFilesB.";
// Set configuration.
@ -496,9 +496,9 @@ TEST_F(MindDataTestPipeline, TestAGNewsDatasetShuffleFilesB) {
original_num_parallel_workers);
}
/// Feature: Test AGNewsDataset Dataset.
/// Description: read AGNewsDataset data and get data.
/// Expectation: the data is processed successfully.
/// Feature: AGNewsDataset
/// Description: Test AGNewsDataset using ShuffleMode::kGlobal
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestAGNewsDatasetShuffleGlobal) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestAGNewsDatasetShuffleGlobal.";
// Test AGNews Dataset with GLOBLE shuffle.

View File

@ -1,5 +1,5 @@
/**
* Copyright 2020-2021 Huawei Technologies Co., Ltd
* Copyright 2020-2022 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -24,8 +24,8 @@ class MindDataTestPipeline : public UT::DatasetOpTesting {
};
/// Feature: AlbumDataset.
/// Description: test basic usage of AlbumDataset.
/// Expectation: get correct number of data.
/// Description: Test basic usage of AlbumDataset.
/// Expectation: Get correct number of data.
TEST_F(MindDataTestPipeline, TestAlbumBasic) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestAlbumBasic.";
@ -159,8 +159,8 @@ TEST_F(MindDataTestPipeline, TestAlbumWithFullSchema) {
}
/// Feature: AlbumDatasetWithPipeline.
/// Description: test usage of AlbumDataset with pipeline.
/// Expectation: get correct number of data.
/// Description: Test usage of AlbumDataset with pipeline.
/// Expectation: Get correct number of data.
TEST_F(MindDataTestPipeline, TestAlbumBasicWithPipeline) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestAlbumBasicWithPipeline.";
@ -217,8 +217,8 @@ TEST_F(MindDataTestPipeline, TestAlbumBasicWithPipeline) {
}
/// Feature: AlbumIteratorOneColumn.
/// Description: test iterator of AlbumDataset with only the "image" column.
/// Expectation: get correct data.
/// Description: Test iterator of AlbumDataset with only the "image" column.
/// Expectation: Get correct data.
TEST_F(MindDataTestPipeline, TestAlbumIteratorOneColumn) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestAlbumIteratorOneColumn.";
// Create a Album Dataset
@ -259,8 +259,8 @@ TEST_F(MindDataTestPipeline, TestAlbumIteratorOneColumn) {
}
/// Feature: AlbumIteratorWrongColumn.
/// Description: test iterator of AlbumDataset with wrong column.
/// Expectation: get none piece of data.
/// Description: Test iterator of AlbumDataset with wrong column.
/// Expectation: Error message is logged, and CreateIterator for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestAlbumIteratorWrongColumn) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestAlbumIteratorWrongColumn.";
// Create a Album Dataset
@ -277,8 +277,8 @@ TEST_F(MindDataTestPipeline, TestAlbumIteratorWrongColumn) {
}
/// Feature: AlbumDatasetGetters.
/// Description: test usage of getters AlbumDataset.
/// Expectation: get correct number of data and correct tensor shape.
/// Description: Test usage of getters AlbumDataset.
/// Expectation: Get correct number of data and correct tensor shape.
TEST_F(MindDataTestPipeline, TestAlbumGetters) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestAlbumGetters.";
@ -308,8 +308,8 @@ TEST_F(MindDataTestPipeline, TestAlbumGetters) {
}
/// Feature: AlbumDecode.
/// Description: test usage of AlbumDecode.
/// Expectation: get correct number of data.
/// Description: Test usage of AlbumDecode.
/// Expectation: Get correct number of data.
TEST_F(MindDataTestPipeline, TestAlbumDecode) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestAlbumDecode.";
std::string folder_path = datasets_root_path_ + "/testAlbum/images";
@ -346,8 +346,8 @@ TEST_F(MindDataTestPipeline, TestAlbumDecode) {
}
/// Feature: AlbumNumSampler.
/// Description: test usage of AlbumDataset with num sampler.
/// Expectation: get correct piece of data.
/// Description: Test usage of AlbumDataset with num sampler.
/// Expectation: Get correct piece of data.
TEST_F(MindDataTestPipeline, TestAlbumNumSamplers) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestAlbumNumSamplers.";
@ -382,8 +382,8 @@ TEST_F(MindDataTestPipeline, TestAlbumNumSamplers) {
}
/// Feature: AlbumError.
/// Description: test failure of Album Dataset.
/// Expectation: get none piece of data.
/// Description: Test failure of Album Dataset.
/// Expectation: Error message is logged, and CreateIterator for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestAlbumError) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestAlbumError.";
std::string folder_path = datasets_root_path_ + "/testAlbum/ima";
@ -400,8 +400,8 @@ TEST_F(MindDataTestPipeline, TestAlbumError) {
}
/// Feature: AlbumWithNullSamplerError.
/// Description: test failure of Album Dataset.
/// Expectation: get none piece of data.
/// Description: Test failure of Album Dataset.
/// Expectation: Error message is logged, and CreateIterator for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestAlbumWithNullSamplerError) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestAlbumWithNullSamplerError.";
std::string folder_path = datasets_root_path_ + "/testAlbum/images";
@ -418,8 +418,8 @@ TEST_F(MindDataTestPipeline, TestAlbumWithNullSamplerError) {
}
/// Feature: AlbumDuplicateColumnNameError.
/// Description: test failure of Album Dataset.
/// Expectation: get none piece of data.
/// Description: Test failure of Album Dataset.
/// Expectation: Error message is logged, and CreateIterator for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestAlbumDuplicateColumnNameError) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestAlbumDuplicateColumnNameError.";
std::string folder_path = datasets_root_path_ + "/testAlbum/images";

View File

@ -1,5 +1,5 @@
/**
* Copyright 2021 Huawei Technologies Co., Ltd
* Copyright 2021-2022 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -26,8 +26,8 @@ protected:
};
/// Feature: AmazonReview
/// Description: read AmazonReviewPolarityDataset data and get data.
/// Expectation: the data is processed successfully.
/// Description: Read AmazonReviewPolarityDataset data and get data.
/// Expectation: The data is processed successfully.
TEST_F(MindDataTestPipeline, TestAmazonReviewPolarityDatasetBasic) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestAmazonReviewPolarityDatasetBasic.";
@ -74,8 +74,8 @@ TEST_F(MindDataTestPipeline, TestAmazonReviewPolarityDatasetBasic) {
}
/// Feature: AmazonReview
/// Description: read AmazonReviewFullDataset data and get data.
/// Expectation: the data is processed successfully.
/// Description: Read AmazonReviewFullDataset data and get data.
/// Expectation: The data is processed successfully.
TEST_F(MindDataTestPipeline, TestAmazonReviewFullDatasetBasic) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestAmazonReviewFullDatasetBasic.";
@ -124,8 +124,8 @@ TEST_F(MindDataTestPipeline, TestAmazonReviewFullDatasetBasic) {
}
/// Feature: AmazonReview(usage=all).
/// Description: read train data and test data.
/// Expectation: the data is processed successfully.
/// Description: Read train data and test data.
/// Expectation: The data is processed successfully.
TEST_F(MindDataTestPipeline, TestAmazonReviewDatasetUsageAll) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestAmazonReviewDatasetUsageAll.";
@ -176,8 +176,8 @@ TEST_F(MindDataTestPipeline, TestAmazonReviewDatasetUsageAll) {
}
/// Feature: AmazonReview
/// Description: test Getter methods
/// Expectation: the data is processed successfully.
/// Description: Test Getter methods
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestAmazonReviewGetters) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestAmazonReviewGetters.";
@ -191,8 +191,8 @@ TEST_F(MindDataTestPipeline, TestAmazonReviewGetters) {
}
/// Feature: AmazonReview(num_samples = 3).
/// Description: test whether the interface meets expectations when NumSamples is equal to 2.
/// Expectation: the data is processed successfully.
/// Description: Test whether the interface meets expectations when NumSamples is equal to 2.
/// Expectation: The data is processed successfully.
TEST_F(MindDataTestPipeline, TestAmazonReviewNumSamples) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestAmazonReviewNumSamples.";
@ -240,8 +240,8 @@ TEST_F(MindDataTestPipeline, TestAmazonReviewNumSamples) {
}
/// Feature: AmazonReview
/// Description: test interface in a distributed state.
/// Expectation: the data is processed successfully.
/// Description: Test interface in a distributed state.
/// Expectation: The data is processed successfully.
TEST_F(MindDataTestPipeline, TestAmazonReviewDatasetDistribution) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestAmazonReviewDatasetDistribution.";
@ -289,8 +289,8 @@ TEST_F(MindDataTestPipeline, TestAmazonReviewDatasetDistribution) {
}
/// Feature: AmazonReview
/// Description: test the wrong input.
/// Expectation: unable to read in data.
/// Description: Test the wrong input.
/// Expectation: Unable to read in data.
TEST_F(MindDataTestPipeline, TestAmazonReviewDatasetFail) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestAmazonReviewDatasetFail.";
@ -340,8 +340,8 @@ TEST_F(MindDataTestPipeline, TestAmazonReviewDatasetFail) {
}
/// Feature: AmazonReview
/// Description: test AmazonReview Dataset interface in pipeline.
/// Expectation: the data is processed successfully.
/// Description: Test AmazonReview Dataset interface in pipeline.
/// Expectation: The data is processed successfully.
TEST_F(MindDataTestPipeline, TestAmazonReviewDatasetBasicWithPipeline) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestAmazonReviewDatasetBasicWithPipeline.";
@ -398,8 +398,8 @@ TEST_F(MindDataTestPipeline, TestAmazonReviewDatasetBasicWithPipeline) {
}
/// Feature: AmazonReview(ShuffleMode=kFiles).
/// Description: test AmazonReview Dataset interface with different ShuffleMode.
/// Expectation: the data is processed successfully.
/// Description: Test AmazonReview Dataset interface with different ShuffleMode.
/// Expectation: The data is processed successfully.
TEST_F(MindDataTestPipeline, TestAmazonReviewDatasetShuffleFilesA) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-AmazonReviewDatasetShuffleFilesA.";
@ -460,8 +460,8 @@ TEST_F(MindDataTestPipeline, TestAmazonReviewDatasetShuffleFilesA) {
}
/// Feature: AmazonReview(ShuffleMode=kInfile).
/// Description: test AmazonReview Dataset interface with different ShuffleMode.
/// Expectation: the data is processed successfully.
/// Description: Test AmazonReview Dataset interface with different ShuffleMode.
/// Expectation: The data is processed successfully.
TEST_F(MindDataTestPipeline, TestAmazonReviewDatasetShuffleFilesB) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestAmazonReviewDatasetShuffleFilesB.";
@ -522,8 +522,8 @@ TEST_F(MindDataTestPipeline, TestAmazonReviewDatasetShuffleFilesB) {
}
/// Feature: AmazonReview(ShuffleMode=kGlobal).
/// Description: test AmazonReview Dataset interface with different ShuffleMode.
/// Expectation: the data is processed successfully.
/// Description: Test AmazonReview Dataset interface with different ShuffleMode.
/// Expectation: The data is processed successfully.
TEST_F(MindDataTestPipeline, TestAmazonReviewDatasetShuffleFilesGlobal) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestAmazonReviewDatasetShuffleFilesGlobal.";

View File

@ -1,5 +1,5 @@
/**
* Copyright 2021 Huawei Technologies Co., Ltd
* Copyright 2021-2022 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -26,8 +26,8 @@ class MindDataTestPipeline : public UT::DatasetOpTesting {
};
/// Feature: Caltech256Dataset
/// Description: basic test of Caltech256Dataset
/// Expectation: the data is processed successfully
/// Description: Basic test of Caltech256Dataset
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestCaltech256Dataset) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCaltech256Dataset.";
@ -63,8 +63,8 @@ TEST_F(MindDataTestPipeline, TestCaltech256Dataset) {
}
/// Feature: Caltech256Dataset
/// Description: test Caltech256Dataset in pipeline mode
/// Expectation: the data is processed successfully
/// Description: Test Caltech256Dataset in pipeline mode
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestCaltech256DatasetWithPipeline) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCaltech256DatasetWithPipeline.";
@ -120,9 +120,9 @@ TEST_F(MindDataTestPipeline, TestCaltech256DatasetWithPipeline) {
iter->Stop();
}
/// Feature: Caltech256IteratorOneColumn.
/// Description: test iterator of Caltech256Dataset with only the "image" column.
/// Expectation: get correct data.
/// Feature: Caltech256Dataset
/// Description: Test iterator of Caltech256Dataset with only the image column
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestCaltech256IteratorOneColumn) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCaltech256IteratorOneColumn.";
// Create a Caltech256 Dataset.
@ -162,9 +162,9 @@ TEST_F(MindDataTestPipeline, TestCaltech256IteratorOneColumn) {
iter->Stop();
}
/// Feature: Caltech256IteratorWrongColumn.
/// Description: test iterator of Caltech256Dataset with wrong column.
/// Expectation: get none piece of data.
/// Feature: Caltech256Dataset
/// Description: Test iterator of Caltech256Dataset with wrong column
/// Expectation: Error message is logged, and CreateIterator for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestCaltech256IteratorWrongColumn) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCaltech256IteratorWrongColumn.";
// Create a Caltech256 Dataset.
@ -179,8 +179,8 @@ TEST_F(MindDataTestPipeline, TestCaltech256IteratorWrongColumn) {
}
/// Feature: Caltech256Dataset
/// Description: test getting size of Caltech256Dataset
/// Expectation: the size is correct
/// Description: Test getting size of Caltech256Dataset
/// Expectation: The size is correct
TEST_F(MindDataTestPipeline, TestCaltech256GetDatasetSize) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCaltech256GetDatasetSize.";
@ -193,8 +193,8 @@ TEST_F(MindDataTestPipeline, TestCaltech256GetDatasetSize) {
}
/// Feature: Caltech256Dataset
/// Description: test Caltech256Dataset with mix getter
/// Expectation: the data is processed successfully
/// Description: Test Caltech256Dataset Getters method
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestCaltech256Getters) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCaltech256MixGetter.";
@ -232,8 +232,8 @@ TEST_F(MindDataTestPipeline, TestCaltech256Getters) {
}
/// Feature: Caltech256Dataset
/// Description: test Caltech256Dataset with the fail of reading dataset
/// Expectation: throw correct error and message
/// Description: Test Caltech256Dataset with the fail of reading dataset
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestCaltech256DatasetFail) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCaltech256DatasetFail.";
@ -248,8 +248,8 @@ TEST_F(MindDataTestPipeline, TestCaltech256DatasetFail) {
}
/// Feature: Caltech256Dataset
/// Description: test Caltech256Dataset with the null sampler
/// Expectation: throw correct error and message
/// Description: Test Caltech256Dataset with the null sampler
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestCaltech256DatasetWithNullSamplerFail) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCaltech256DatasetWithNullSamplerFail.";

View File

@ -1,5 +1,5 @@
/**
* Copyright 2020-2021 Huawei Technologies Co., Ltd
* Copyright 2020-2022 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -26,6 +26,9 @@ class MindDataTestPipeline : public UT::DatasetOpTesting {
protected:
};
/// Feature: Cifar10Dataset
/// Description: Basic test of Cifar10Dataset
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestCifar10Dataset) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCifar10Dataset.";
@ -60,6 +63,9 @@ TEST_F(MindDataTestPipeline, TestCifar10Dataset) {
iter->Stop();
}
/// Feature: Cifar10Dataset
/// Description: Test Cifar10Dataset in pipeline mode
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestCifar10DatasetWithPipeline) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCifar10DatasetWithPipeline.";
@ -115,6 +121,9 @@ TEST_F(MindDataTestPipeline, TestCifar10DatasetWithPipeline) {
iter->Stop();
}
/// Feature: Cifar10Dataset
/// Description: Test Cifar10Dataset GetDatasetSize
/// Expectation: The size is correct
TEST_F(MindDataTestPipeline, TestCifar10GetDatasetSize) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCifar10GetDatasetSize.";
@ -126,6 +135,9 @@ TEST_F(MindDataTestPipeline, TestCifar10GetDatasetSize) {
EXPECT_EQ(ds->GetDatasetSize(), 10000);
}
/// Feature: Cifar10Dataset
/// Description: Test Cifar10Dataset Getters method
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestCifar10Getters) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCifar10MixGetter.";
@ -164,6 +176,9 @@ TEST_F(MindDataTestPipeline, TestCifar10Getters) {
EXPECT_EQ(ds->GetDatasetSize(), 10000);
}
/// Feature: Cifar100Dataset
/// Description: Basic test of Cifar100Dataset
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestCifar100Dataset) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCifar100Dataset.";
@ -199,6 +214,9 @@ TEST_F(MindDataTestPipeline, TestCifar100Dataset) {
iter->Stop();
}
/// Feature: Cifar100Dataset
/// Description: Test Cifar100Dataset Getters method
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestCifar100Getters) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCifar100Getters.";
@ -227,6 +245,9 @@ TEST_F(MindDataTestPipeline, TestCifar100Getters) {
EXPECT_EQ(ds->GetColumnNames(), column_names);
}
/// Feature: Cifar100Dataset
/// Description: Test Cifar100Dataset with invalid input
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestCifar100DatasetFail) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCifar100DatasetFail.";
@ -240,6 +261,9 @@ TEST_F(MindDataTestPipeline, TestCifar100DatasetFail) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: Cifar10Dataset
/// Description: Test Cifar10Dataset with invalid input
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestCifar10DatasetFail) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCifar10DatasetFail.";
@ -253,6 +277,9 @@ TEST_F(MindDataTestPipeline, TestCifar10DatasetFail) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: Cifar10Dataset
/// Description: Test Cifar10Dataset with invalid usage arg
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestCifar10DatasetWithInvalidUsageFail) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCifar10DatasetWithNullSamplerFail.";
@ -267,6 +294,9 @@ TEST_F(MindDataTestPipeline, TestCifar10DatasetWithInvalidUsageFail) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: Cifar10Dataset
/// Description: Test Cifar10Dataset with invalid sampler (using nullptr)
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestCifar10DatasetWithNullSamplerFail) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCifar10DatasetWithNullSamplerFail.";
@ -281,6 +311,9 @@ TEST_F(MindDataTestPipeline, TestCifar10DatasetWithNullSamplerFail) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: Cifar100Dataset
/// Description: Test Cifar100Dataset with invalid sampler (using nullptr)
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestCifar100DatasetWithNullSamplerFail) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCifar100DatasetWithNullSamplerFail.";
@ -295,6 +328,9 @@ TEST_F(MindDataTestPipeline, TestCifar100DatasetWithNullSamplerFail) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: Cifar100Dataset
/// Description: Test Cifar100Dataset with invalid sampler (sampler that is not constructed properly)
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestCifar100DatasetWithWrongSamplerFail) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCifar100DatasetWithWrongSamplerFail.";

View File

@ -1,5 +1,5 @@
/**
* Copyright 2021 Huawei Technologies Co., Ltd
* Copyright 2021-2022 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -26,6 +26,9 @@ class MindDataTestPipeline : public UT::DatasetOpTesting {
protected:
};
/// Feature: CityscapesDataset
/// Description: Basic test of CityscapesDataset
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestCityscapesBasic) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCityscapesBasic.";
@ -62,6 +65,9 @@ TEST_F(MindDataTestPipeline, TestCityscapesBasic) {
iter->Stop();
}
/// Feature: CityscapesDataset
/// Description: Test CityscapesDataset in pipeline mode
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestCityscapesBasicWithPipeline) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCityscapesBasicWithPipeline.";
@ -119,6 +125,9 @@ TEST_F(MindDataTestPipeline, TestCityscapesBasicWithPipeline) {
iter->Stop();
}
/// Feature: CityscapesDataset
/// Description: Test CityscapesDataset Getters method
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestCityscapesGetters) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCityscapesGetters.";
@ -144,6 +153,9 @@ TEST_F(MindDataTestPipeline, TestCityscapesGetters) {
EXPECT_EQ(ds2->GetBatchSize(), 1);
}
/// Feature: CityscapesDataset
/// Description: Test CityscapesDataset in where the dataset comes from .json file
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestCityscapesTaskJson) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCityscapesTaskJson.";
@ -191,6 +203,9 @@ TEST_F(MindDataTestPipeline, TestCityscapesTaskJson) {
iter->Stop();
}
/// Feature: CityscapesDataset
/// Description: Test CityscapesDataset with Decode
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestCityscapesDecode) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCityscapesDecode.";
@ -231,6 +246,9 @@ TEST_F(MindDataTestPipeline, TestCityscapesDecode) {
iter->Stop();
}
/// Feature: CityscapesDataset
/// Description: Test CityscapesDataset using sampler
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestCityscapesNumSamplers) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCityscapesNumSamplers.";
@ -270,6 +288,9 @@ TEST_F(MindDataTestPipeline, TestCityscapesNumSamplers) {
iter->Stop();
}
/// Feature: CityscapesDataset
/// Description: Test CityscapesDataset with invalid inputs
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestCityscapesError) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCityscapesError.";
@ -315,6 +336,9 @@ TEST_F(MindDataTestPipeline, TestCityscapesError) {
EXPECT_EQ(iter3, nullptr);
}
/// Feature: CityscapesDataset
/// Description: Test CityscapesDataset using nullptr for sampler
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestCityscapesWithNullSamplerError) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCityscapesWithNullSamplerError.";

View File

@ -1,5 +1,5 @@
/**
* Copyright 2020-2021 Huawei Technologies Co., Ltd
* Copyright 2020-2022 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -26,6 +26,9 @@ class MindDataTestPipeline : public UT::DatasetOpTesting {
protected:
};
/// Feature: CLUEDataset
/// Description: Test CLUEDataset using AFQMC task
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestCLUEDatasetAFQMC) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCLUEDatasetAFQMC.";
@ -118,6 +121,9 @@ TEST_F(MindDataTestPipeline, TestCLUEDatasetAFQMC) {
iter->Stop();
}
/// Feature: CLUEDataset
/// Description: Test CLUEDataset basic usage
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestCLUEDatasetBasic) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCLUEDatasetBasic.";
@ -153,6 +159,9 @@ TEST_F(MindDataTestPipeline, TestCLUEDatasetBasic) {
iter->Stop();
}
/// Feature: CLUEDataset
/// Description: Test CLUEDataset in pipeline mode
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestCLUEDatasetBasicWithPipeline) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCLUEDatasetBasicWithPipeline.";
@ -209,6 +218,9 @@ TEST_F(MindDataTestPipeline, TestCLUEDatasetBasicWithPipeline) {
iter->Stop();
}
/// Feature: CLUEDataset
/// Description: Test CLUEDataset Getters method
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestCLUEGetters) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCLUEGetters.";
@ -224,6 +236,9 @@ TEST_F(MindDataTestPipeline, TestCLUEGetters) {
EXPECT_EQ(ds->GetColumnNames(), column_names);
}
/// Feature: CLUEDataset
/// Description: Test CLUEDataset using CMNLI task
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestCLUEDatasetCMNLI) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCLUEDatasetCMNLI.";
@ -267,6 +282,9 @@ TEST_F(MindDataTestPipeline, TestCLUEDatasetCMNLI) {
iter->Stop();
}
/// Feature: CLUEDataset
/// Description: Test CLUEDataset using CSL task
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestCLUEDatasetCSL) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCLUEDatasetCSL.";
@ -310,6 +328,9 @@ TEST_F(MindDataTestPipeline, TestCLUEDatasetCSL) {
iter->Stop();
}
/// Feature: CLUEDataset
/// Description: Test distributed CLUEDataset (using num_shards and shard_id)
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestCLUEDatasetDistribution) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCLUEDatasetDistribution.";
@ -345,6 +366,9 @@ TEST_F(MindDataTestPipeline, TestCLUEDatasetDistribution) {
iter->Stop();
}
/// Feature: CLUEDataset
/// Description: Test CLUEDataset using invalid inputs
/// Expectation: Correct error and messagre are thrown
TEST_F(MindDataTestPipeline, TestCLUEDatasetFail) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCLUEDatasetFail.";
// Create a CLUE Dataset
@ -410,6 +434,9 @@ TEST_F(MindDataTestPipeline, TestCLUEDatasetFail) {
EXPECT_EQ(iter7, nullptr);
}
/// Feature: CLUEDataset
/// Description: Test CLUEDataset using IFLYTEK task
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestCLUEDatasetIFLYTEK) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCLUEDatasetIFLYTEK.";
@ -453,6 +480,10 @@ TEST_F(MindDataTestPipeline, TestCLUEDatasetIFLYTEK) {
iter->Stop();
}
/// Feature: CLUEDataset
/// Description: Test CLUEDataset using ShuffleMode:kFiles
/// with two text files, dev.json and train.json, in lexicographical order
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestCLUEDatasetShuffleFilesA) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCLUEDatasetShuffleFilesA.";
// Test CLUE Dataset with files shuffle, num_parallel_workers=1
@ -520,6 +551,10 @@ TEST_F(MindDataTestPipeline, TestCLUEDatasetShuffleFilesA) {
GlobalContext::config_manager()->set_num_parallel_workers(original_num_parallel_workers);
}
/// Feature: CLUEDataset
/// Description: Test CLUEDataset using ShuffleMode::kFiles with two text files,
/// train.json and dev.json, in non-lexicographical order
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestCLUEDatasetShuffleFilesB) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCLUEDatasetShuffleFilesB.";
// Test CLUE Dataset with files shuffle, num_parallel_workers=1
@ -586,6 +621,9 @@ TEST_F(MindDataTestPipeline, TestCLUEDatasetShuffleFilesB) {
GlobalContext::config_manager()->set_num_parallel_workers(original_num_parallel_workers);
}
/// Feature: CLUEDataset
/// Description: Test CLUEDataset using ShuffleMode::kGlobal
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestCLUEDatasetShuffleGlobal) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCLUEDatasetShuffleGlobal.";
// Test CLUE Dataset with GLOBLE shuffle
@ -641,6 +679,9 @@ TEST_F(MindDataTestPipeline, TestCLUEDatasetShuffleGlobal) {
GlobalContext::config_manager()->set_num_parallel_workers(original_num_parallel_workers);
}
/// Feature: CLUEDataset
/// Description: Test CLUEDataset using TNEWS task
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestCLUEDatasetTNEWS) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCLUEDatasetTNEWS.";
@ -684,6 +725,9 @@ TEST_F(MindDataTestPipeline, TestCLUEDatasetTNEWS) {
iter->Stop();
}
/// Feature: CLUEDataset
/// Description: Test CLUEDataset using WSC task
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestCLUEDatasetWSC) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCLUEDatasetWSC.";

View File

@ -26,8 +26,8 @@ class MindDataTestPipeline : public UT::DatasetOpTesting {
};
/// Feature: CMUArcticDataset
/// Description: test CMUArctic
/// Expectation: get correct CMUArctic dataset
/// Description: Test CMUArcticDataset basic usage
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestCMUArcticBasic) {
MS_LOG(INFO) << "Doing CMUArcticDataTestPipeline-TestCMUArcticBasic.";
@ -82,8 +82,8 @@ TEST_F(MindDataTestPipeline, TestCMUArcticBasic) {
}
/// Feature: CMUArcticDataset
/// Description: test CMUArctic with Pipeline
/// Expectation: get correct CMUArctic dataset
/// Description: Test CMUArcticDataset in pipeline mode
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestCMUArcticBasicWithPipeline) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCMUArcticBasicWithPipeline.";
@ -138,8 +138,8 @@ TEST_F(MindDataTestPipeline, TestCMUArcticBasicWithPipeline) {
}
/// Feature: CMUArcticDataset
/// Description: test CMUArctic with invalid directory
/// Expectation: get correct CMUArctic dataset
/// Description: Test CMUArcticDataset with non-existing dataset directory
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestCMUArcticError) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCMUArcticError.";
@ -163,8 +163,8 @@ TEST_F(MindDataTestPipeline, TestCMUArcticError) {
}
/// Feature: CMUArcticDataset
/// Description: test CMUArctic with Getters
/// Expectation: dataset is null
/// Description: Test CMUArcticDataset Getters method
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestCMUArcticGetters) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCMUArcticGetters.";
@ -185,8 +185,8 @@ TEST_F(MindDataTestPipeline, TestCMUArcticGetters) {
}
/// Feature: CMUArcticDataset
/// Description: test CMUArctic dataset with invalid name
/// Expectation: dataset is null
/// Description: Test CMUArcticDataset with invalid name
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestCMUArcticWithInvalidNameError) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCMUArcticWithInvalidNameError.";
@ -210,8 +210,8 @@ TEST_F(MindDataTestPipeline, TestCMUArcticWithInvalidNameError) {
}
/// Feature: CMUArcticDataset
/// Description: test CMUArctic dataset with null sampler
/// Expectation: dataset is null
/// Description: Test CMUArcticDataset with null sampler
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestCMUArcticWithNullSamplerError) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCMUArcticWithNullSamplerError.";
@ -227,8 +227,8 @@ TEST_F(MindDataTestPipeline, TestCMUArcticWithNullSamplerError) {
}
/// Feature: CMUArcticDataset
/// Description: test CMUArctic with sequential sampler
/// Expectation: get correct CMUArctic dataset
/// Description: Test CMUArcticDataset with SequentialSampler
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestCMUArcticNumSamplers) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCMUArcticWithSequentialSampler.";

View File

@ -26,8 +26,8 @@ class MindDataTestPipeline : public UT::DatasetOpTesting {
};
/// Feature: CocoDataset
/// Description: default test of CocoDataset
/// Expectation: the data is processed successfully
/// Description: Default test of CocoDataset
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestCocoDefault) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCocoDefault.";
// Create a Coco Dataset.
@ -65,8 +65,8 @@ TEST_F(MindDataTestPipeline, TestCocoDefault) {
}
/// Feature: CocoDataset
/// Description: default pipeline test of CocoDataset
/// Expectation: the data is processed successfully
/// Description: Default pipeline test of CocoDataset
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestCocoDefaultWithPipeline) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCocoDefaultWithPipeline.";
// Create two Coco Dataset.
@ -125,8 +125,8 @@ TEST_F(MindDataTestPipeline, TestCocoDefaultWithPipeline) {
}
/// Feature: CocoDataset
/// Description: test getters of CocoDataset
/// Expectation: the data is processed successfully
/// Description: Test getters of CocoDataset
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestCocoGetters) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCocoGetters.";
// Create a Coco Dataset.
@ -142,8 +142,8 @@ TEST_F(MindDataTestPipeline, TestCocoGetters) {
}
/// Feature: CocoDataset
/// Description: test detection task of CocoDataset
/// Expectation: the data is processed successfully
/// Description: Test detection task of CocoDataset
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestCocoDetection) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCocoDetection.";
// Create a Coco Dataset.
@ -205,8 +205,8 @@ TEST_F(MindDataTestPipeline, TestCocoDetection) {
}
/// Feature: CocoDataset
/// Description: test fail of CocoDataset
/// Expectation: throw correct error and message
/// Description: Test fail of CocoDataset
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestCocoFail) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCocoFail.";
// Create a Coco Dataset.
@ -238,8 +238,8 @@ TEST_F(MindDataTestPipeline, TestCocoFail) {
}
/// Feature: CocoDataset
/// Description: test keypoint task of CocoDataset
/// Expectation: the data is processed successfully
/// Description: Test keypoint task of CocoDataset
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestCocoKeypoint) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCocoKeypoint.";
// Create a Coco Dataset.
@ -303,8 +303,8 @@ TEST_F(MindDataTestPipeline, TestCocoKeypoint) {
}
/// Feature: CocoDataset
/// Description: test panoptic task of CocoDataset
/// Expectation: the data is processed successfully
/// Description: Test panoptic task of CocoDataset
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestCocoPanoptic) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCocoPanoptic.";
// Create a Coco Dataset.
@ -379,8 +379,8 @@ TEST_F(MindDataTestPipeline, TestCocoPanoptic) {
}
/// Feature: CocoDataset
/// Description: test get class index of panoptic task
/// Expectation: the data is processed successfully
/// Description: Test get class index of panoptic task
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestCocoPanopticGetClassIndex) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCocoPanopticGetClassIndex.";
// Create a Coco Dataset.
@ -405,8 +405,8 @@ TEST_F(MindDataTestPipeline, TestCocoPanopticGetClassIndex) {
}
/// Feature: CocoDataset
/// Description: test stuff task of CocoDataset
/// Expectation: the data is processed successfully
/// Description: Test stuff task of CocoDataset
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestCocoStuff) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCocoStuff.";
// Create a Coco Dataset.
@ -464,8 +464,8 @@ TEST_F(MindDataTestPipeline, TestCocoStuff) {
}
/// Feature: CocoDataset
/// Description: test captioning task of CocoDataset
/// Expectation: the data is processed successfully
/// Description: Test captioning task of CocoDataset
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestCocoCaptioning) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCocoCaptioning.";
// Create a Coco Dataset.
@ -514,8 +514,8 @@ TEST_F(MindDataTestPipeline, TestCocoCaptioning) {
}
/// Feature: CocoDataset
/// Description: test CocoDataset with the null sampler
/// Expectation: throw correct error and message
/// Description: Test CocoDataset with the null sampler
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestCocoWithNullSamplerFail) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCocoWithNullSamplerFail.";
// Create a Coco Dataset.

View File

@ -1,5 +1,5 @@
/**
* Copyright 2020-2021 Huawei Technologies Co., Ltd
* Copyright 2020-2022 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -26,6 +26,9 @@ class MindDataTestPipeline : public UT::DatasetOpTesting {
protected:
};
/// Feature: Config
/// Description: Test basic configuration setting
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestConfigSetting) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestConfigSetting.";
// Test basic configuration setting
@ -70,6 +73,9 @@ TEST_F(MindDataTestPipeline, TestConfigSetting) {
config::set_monitor_sampling_interval(original_monitor_sampling_interval);
}
/// Feature: Config
/// Description: Test configuration setting with wrong parameter
/// Expectation: Config attributes are equal to the expected attributes
TEST_F(MindDataTestPipeline, TestConfigParamCheck) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestConfigParamCheck.";
// Test configuration setting with wrong parameter
@ -102,6 +108,9 @@ TEST_F(MindDataTestPipeline, TestConfigParamCheck) {
config::set_monitor_sampling_interval(original_monitor_sampling_interval);
}
/// Feature: Config
/// Description: Test deterministic shuffle with setting the seed
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestShuffleWithSeed) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestShuffleWithSeed.";
// Test deterministic shuffle with setting the seed
@ -162,6 +171,9 @@ TEST_F(MindDataTestPipeline, TestShuffleWithSeed) {
config::set_num_parallel_workers(original_num_parallel_workers);
}
/// Feature: Config
/// Description: Test shuffle and repeat with setting the seed
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestCallShuffleTwice) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCallShuffleTwice.";
// Test shuffle and repeat with setting the seed.

View File

@ -1,5 +1,5 @@
/**
* Copyright 2021 Huawei Technologies Co., Ltd
* Copyright 2021-2022 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -25,9 +25,9 @@ class MindDataTestPipeline : public UT::DatasetOpTesting {
protected:
};
/// Feature: CoNLL2000ChunkingDataset.
/// Description: test CoNLL2000ChunkingDataset in pipeline mode.
/// Expectation: the data is processed successfully.
/// Feature: CoNLL2000Dataset
/// Description: Test CoNLL2000Dataset basic usage
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestCoNLL2000DatasetBasic) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCoNLL2000DatasetBasic.";
// Test CoNLL2000 Dataset with single text file and many default inputs.
@ -84,9 +84,9 @@ TEST_F(MindDataTestPipeline, TestCoNLL2000DatasetBasic) {
GlobalContext::config_manager()->set_num_parallel_workers(original_num_parallel_workers);
}
/// Feature: CoNLL2000ChunkingDataset.
/// Description: test CoNLL2000ChunkingDataset in pipeline mode.
/// Expectation: the data is processed successfully.
/// Feature: CoNLL2000Dataset
/// Description: Test CoNLL2000Dataset in pipeline mode
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestCoNLL2000DatasetBasicWithPipeline) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCoNLL2000DatasetBasicWithPipeline.";
// Test CoNLL2000 Dataset with single text file and many default inputs.
@ -151,9 +151,9 @@ TEST_F(MindDataTestPipeline, TestCoNLL2000DatasetBasicWithPipeline) {
GlobalContext::config_manager()->set_num_parallel_workers(original_num_parallel_workers);
}
/// Feature: CoNLL2000ChunkingDataset.
/// Description: test CoNLL2000ChunkingDataset in pipeline mode.
/// Expectation: the data is processed successfully.
/// Feature: CoNLL2000Dataset
/// Description: Test CoNLL2000Dataset Getters method
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestCoNLL2000Getters) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCoNLL2000Getters.";
// Test CoNLL2000 Dataset with single text file and many default inputs.
@ -186,9 +186,9 @@ TEST_F(MindDataTestPipeline, TestCoNLL2000Getters) {
GlobalContext::config_manager()->set_num_parallel_workers(original_num_parallel_workers);
}
/// Feature: CoNLL2000ChunkingDataset.
/// Description: test CoNLL2000ChunkingDataset in pipeline mode.
/// Expectation: the data is processed successfully.
/// Feature: CoNLL2000Dataset
/// Description: Test CoNLL2000Dataset with invalid samplers
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestCoNLL2000DatasetFail1) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCoNLL2000DatasetFail1.";
@ -204,9 +204,9 @@ TEST_F(MindDataTestPipeline, TestCoNLL2000DatasetFail1) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: CoNLL2000ChunkingDataset.
/// Description: test CoNLL2000ChunkingDataset in pipeline mode.
/// Expectation: the data is processed successfully.
/// Feature: CoNLL2000Dataset
/// Description: Test CoNLL2000Dataset with empty dataset_files
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestCoNLL2000DatasetFail2) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCoNLL2000DatasetFail2.";
@ -221,9 +221,9 @@ TEST_F(MindDataTestPipeline, TestCoNLL2000DatasetFail2) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: CoNLL2000ChunkingDataset.
/// Description: test CoNLL2000ChunkingDataset in pipeline mode.
/// Expectation: the data is processed successfully.
/// Feature: CoNLL2000Dataset
/// Description: Test CoNLL2000Dataset with non-existent dataset_files
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestCoNLL2000DatasetFail3) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCoNLL2000DatasetFail3.";
@ -239,9 +239,9 @@ TEST_F(MindDataTestPipeline, TestCoNLL2000DatasetFail3) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: CoNLL2000ChunkingDataset.
/// Description: test CoNLL2000ChunkingDataset in pipeline mode.
/// Expectation: the data is processed successfully.
/// Feature: CoNLL2000Dataset
/// Description: Test CoNLL2000Dataset with empty string as an input to dataset_files
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestCoNLL2000DatasetFail4) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCoNLL2000DatasetFail4.";
@ -257,9 +257,9 @@ TEST_F(MindDataTestPipeline, TestCoNLL2000DatasetFail4) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: CoNLL2000ChunkingDataset.
/// Description: test CoNLL2000ChunkingDataset in pipeline mode.
/// Expectation: the data is processed successfully.
/// Feature: CoNLL2000Dataset
/// Description: Test CoNLL2000Dataset with invalid num_shards value
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestCoNLL2000DatasetFail5) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCoNLL2000DatasetFail5.";
@ -275,9 +275,9 @@ TEST_F(MindDataTestPipeline, TestCoNLL2000DatasetFail5) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: CoNLL2000ChunkingDataset.
/// Description: test CoNLL2000ChunkingDataset in pipeline mode.
/// Expectation: the data is processed successfully.
/// Feature: CoNLL2000Dataset
/// Description: Test CoNLL2000Dataset with invalid shard_id value
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestCoNLL2000DatasetFail6) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCoNLL2000DatasetFail6.";
@ -293,9 +293,9 @@ TEST_F(MindDataTestPipeline, TestCoNLL2000DatasetFail6) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: CoNLL2000ChunkingDataset.
/// Description: test CoNLL2000ChunkingDataset in pipeline mode.
/// Expectation: the data is processed successfully.
/// Feature: CoNLL2000Dataset
/// Description: Test CoNLL2000Dataset with invalid shard_id and num_shards values
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestCoNLL2000DatasetFail7) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCoNLL2000DatasetFail7.";
@ -311,9 +311,9 @@ TEST_F(MindDataTestPipeline, TestCoNLL2000DatasetFail7) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: CoNLL2000ChunkingDataset.
/// Description: test CoNLL2000ChunkingDataset in pipeline mode.
/// Expectation: the data is processed successfully.
/// Feature: CoNLL2000Dataset
/// Description: Test CoNLL2000Dataset with no shuffle
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestCoNLL2000DatasetShuffleFalse) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCoNLL2000DatasetShuffleFalse.";
// Test CoNLL2000 Dataset with two text files and no shuffle, num_parallel_workers=4.
@ -375,9 +375,9 @@ TEST_F(MindDataTestPipeline, TestCoNLL2000DatasetShuffleFalse) {
GlobalContext::config_manager()->set_num_parallel_workers(original_num_parallel_workers);
}
/// Feature: CoNLL2000ChunkingDataset.
/// Description: test CoNLL2000ChunkingDataset in pipeline mode.
/// Expectation: the data is processed successfully.
/// Feature: CoNLL2000Dataset
/// Description: Test CoNLL2000Dataset with ShuffleMode::kFalse
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestCoNLL2000DatasetShuffleFilesA) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCoNLL2000DatasetShuffleFilesA.";
// Test CoNLL2000 Dataset with files shuffle, num_parallel_workers=4.
@ -439,9 +439,9 @@ TEST_F(MindDataTestPipeline, TestCoNLL2000DatasetShuffleFilesA) {
GlobalContext::config_manager()->set_num_parallel_workers(original_num_parallel_workers);
}
/// Feature: CoNLL2000ChunkingDataset.
/// Description: test CoNLL2000ChunkingDataset in pipeline mode.
/// Expectation: the data is processed successfully.
/// Feature: CoNLL2000Dataset
/// Description: Test CoNLL2000Dataset with ShuffleMode::kFalse
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestCoNLL2000DatasetShuffleFilesB) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCoNLL2000DatasetShuffleFilesB.";
// Test CoNLL2000 Dataset with files shuffle, num_parallel_workers=4.
@ -503,9 +503,9 @@ TEST_F(MindDataTestPipeline, TestCoNLL2000DatasetShuffleFilesB) {
GlobalContext::config_manager()->set_num_parallel_workers(original_num_parallel_workers);
}
/// Feature: CoNLL2000ChunkingDataset.
/// Description: test CoNLL2000ChunkingDataset in pipeline mode.
/// Expectation: the data is processed successfully.
/// Feature: CoNLL2000Dataset
/// Description: Test CoNLL2000Dataset with ShuffleMode::kFalse and with one text file only
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestCoNLL2000DatasetShuffleGlobal1A) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCoNLL2000DatasetShuffleGlobalA.";
// Test CoNLL2000 Dataset with 1 text file, global shuffle, num_parallel_workers=4.
@ -563,9 +563,9 @@ TEST_F(MindDataTestPipeline, TestCoNLL2000DatasetShuffleGlobal1A) {
GlobalContext::config_manager()->set_num_parallel_workers(original_num_parallel_workers);
}
/// Feature: CoNLL2000ChunkingDataset.
/// Description: test CoNLL2000ChunkingDataset in pipeline mode.
/// Expectation: the data is processed successfully.
/// Feature: CoNLL2000Dataset
/// Description: Test CoNLL2000Dataset with ShuffleMode::kFalse with 2 text files
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestCoNLL2000DatasetShuffleGlobalB) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCoNLL2000DatasetShuffleGlobalB.";
// Test CoNLL200 Dataset with 2 text files, global shuffle, num_parallel_workers=4.

View File

@ -1,5 +1,5 @@
/**
* Copyright 2020-2021 Huawei Technologies Co., Ltd
* Copyright 2020-2022 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -26,6 +26,9 @@ class MindDataTestPipeline : public UT::DatasetOpTesting {
protected:
};
/// Feature: CSVDataset
/// Description: Test CSVDataset basic usage
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestCSVDatasetBasic) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCSVDatasetBasic.";
@ -72,6 +75,9 @@ TEST_F(MindDataTestPipeline, TestCSVDatasetBasic) {
iter->Stop();
}
/// Feature: CSVDataset
/// Description: Test CSVDataset Getters method
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestCSVGetters) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCSVGetters.";
@ -85,6 +91,9 @@ TEST_F(MindDataTestPipeline, TestCSVGetters) {
EXPECT_EQ(ds->GetColumnNames(), column_names);
}
/// Feature: CSVDataset
/// Description: Test CSVDataset with multiple files
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestCSVDatasetMultiFiles) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCSVDatasetMultiFiles.";
@ -142,6 +151,9 @@ TEST_F(MindDataTestPipeline, TestCSVDatasetMultiFiles) {
GlobalContext::config_manager()->set_num_parallel_workers(original_num_parallel_workers);
}
/// Feature: CSVDataset
/// Description: Test CSVDataset with num_samples
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestCSVDatasetNumSamples) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCSVDatasetNumSamples.";
@ -184,6 +196,9 @@ TEST_F(MindDataTestPipeline, TestCSVDatasetNumSamples) {
iter->Stop();
}
/// Feature: CSVDataset
/// Description: Test distributed CSVDataset (with shard_id and num_shards)
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestCSVDatasetDistribution) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCSVDatasetDistribution.";
@ -226,6 +241,9 @@ TEST_F(MindDataTestPipeline, TestCSVDatasetDistribution) {
iter->Stop();
}
/// Feature: CSVDataset
/// Description: Test CSVDataset where each column has different data type
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestCSVDatasetType) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCSVDatasetType.";
@ -297,6 +315,9 @@ TEST_F(MindDataTestPipeline, TestCSVDatasetType) {
iter->Stop();
}
/// Feature: CSVDataset
/// Description: Test CSVDataset on header file
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestCSVDatasetHeader) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCSVDatasetHeader.";
@ -341,6 +362,9 @@ TEST_F(MindDataTestPipeline, TestCSVDatasetHeader) {
iter->Stop();
}
/// Feature: CSVDataset
/// Description: Test CSVDataset with invalid inputs
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestCSVDatasetFail) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCSVDatasetFail.";
// Create a CSV Dataset
@ -397,6 +421,9 @@ TEST_F(MindDataTestPipeline, TestCSVDatasetFail) {
EXPECT_EQ(iter5, nullptr);
}
/// Feature: CSVDataset
/// Description: Test with ShuffleMode::kFiles with 2 CSV files, 1.csv and append.csv in lexicographical order
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestCSVDatasetShuffleFilesA) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCSVDatasetShuffleFilesA.";
@ -454,6 +481,9 @@ TEST_F(MindDataTestPipeline, TestCSVDatasetShuffleFilesA) {
GlobalContext::config_manager()->set_num_parallel_workers(original_num_parallel_workers);
}
/// Feature: CSVDataset
/// Description: Test with ShuffleMode::kFiles with 2 CSV files, append.csv and 1.csv in lexicographical order
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestCSVDatasetShuffleFilesB) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCSVDatasetShuffleFilesB.";
@ -512,6 +542,9 @@ TEST_F(MindDataTestPipeline, TestCSVDatasetShuffleFilesB) {
GlobalContext::config_manager()->set_num_parallel_workers(original_num_parallel_workers);
}
/// Feature: CSVDataset
/// Description: Test CSVDataset with ShuffleMode::kGlobal
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestCSVDatasetShuffleGlobal) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCSVDatasetShuffleGlobal.";
// Test CSV Dataset with GLOBLE shuffle
@ -567,6 +600,9 @@ TEST_F(MindDataTestPipeline, TestCSVDatasetShuffleGlobal) {
GlobalContext::config_manager()->set_num_parallel_workers(original_num_parallel_workers);
}
/// Feature: CSVDataset
/// Description: Test CSVDataset with duplicate column name
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestCSVDatasetDuplicateColumnNameFail) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCSVDatasetDuplicateColumnNameFail.";

View File

@ -1,5 +1,5 @@
/**
* Copyright 2021 Huawei Technologies Co., Ltd
* Copyright 2021-2022 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -23,9 +23,9 @@ class MindDataTestPipeline : public UT::DatasetOpTesting {
protected:
};
/// Feature: DBpedia.
/// Description: read test data.
/// Expectation: the data is processed successfully.
/// Feature: DBpediaDataset
/// Description: Test DBpediaDataset basic usage
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestDBpediaDatasetBasic) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestDBpediaDatasetBasic.";
@ -70,9 +70,9 @@ TEST_F(MindDataTestPipeline, TestDBpediaDatasetBasic) {
iter->Stop();
}
/// Feature: DBpedia.
/// Description: read train data and test data.
/// Expectation: the data is processed successfully.
/// Feature: DBpediaDataset
/// Description: Test DBpediaDataset with all as usage
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestDBpediaDatasetUsageAll) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestDBpediaDatasetUsageAll.";
@ -119,9 +119,9 @@ TEST_F(MindDataTestPipeline, TestDBpediaDatasetUsageAll) {
iter->Stop();
}
/// Feature: TestDBpediaDatasetIteratorOneColumn.
/// Description: test iterator of DBpediaDataset with only the "class" column.
/// Expectation: get correct data.
/// Feature: DBpediaDataset
/// Description: Test iterator of DBpediaDataset with only the class column
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestDBpediaDatasetIteratorOneColumn) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestDBpediaDatasetIteratorOneColumn.";
// Create a DBpedia Dataset
@ -162,9 +162,9 @@ TEST_F(MindDataTestPipeline, TestDBpediaDatasetIteratorOneColumn) {
iter->Stop();
}
/// Feature: DBpediaDatasetIteratorWrongColumn.
/// Description: test iterator of DBpediaDataset with wrong column.
/// Expectation: get none piece of data.
/// Feature: DBpediaDataset
/// Description: Test iterator of DBpediaDataset with wrong column
/// Expectation: Get none piece of data
TEST_F(MindDataTestPipeline, TestDBpediaDatasetIteratorWrongColumn) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestDBpediaDatasetIteratorWrongColumn.";
// Create a DBpedia Dataset
@ -179,9 +179,9 @@ TEST_F(MindDataTestPipeline, TestDBpediaDatasetIteratorWrongColumn) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: DBpedia.
/// Description: includes tests for shape, type, size.
/// Expectation: the data is processed successfully.
/// Feature: DBpediaDataset
/// Description: Test DBpediaDataset Getters method
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestDBpediaDatasetGetters) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestDBpediaDatasetGetters.";
@ -206,9 +206,9 @@ TEST_F(MindDataTestPipeline, TestDBpediaDatasetGetters) {
EXPECT_EQ(ds->GetColumnNames(), column_names);
}
/// Feature: DBpedia.
/// Description: read 2 samples from train file.
/// Expectation: the data is processed successfully.
/// Feature: DBpediaDataset
/// Description: Test DBpediaDataset with num_samples
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestDBpediaDatasetNumSamples) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestDBpediaDatasetNumSamples.";
@ -253,9 +253,9 @@ TEST_F(MindDataTestPipeline, TestDBpediaDatasetNumSamples) {
iter->Stop();
}
/// Feature: DBpedia.
/// Description: test in a distributed state.
/// Expectation: the data is processed successfully.
/// Feature: DBpediaDataset
/// Description: Test distributed DBpediaDataset (with num_shards and shard_id)
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestDBpediaDatasetDistribution) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestDBpediaDatasetDistribution.";
@ -300,9 +300,9 @@ TEST_F(MindDataTestPipeline, TestDBpediaDatasetDistribution) {
iter->Stop();
}
/// Feature: DBpedia.
/// Description: test with invalid input.
/// Expectation: throw error messages when certain errors occur.
/// Feature: DBpediaDataset
/// Description: Test DBpediaDataset with invalid inputs
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestDBpediaDatasetFail) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestDBpediaDatasetFail.";
// Create a DBpedia Dataset
@ -351,9 +351,9 @@ TEST_F(MindDataTestPipeline, TestDBpediaDatasetFail) {
EXPECT_EQ(iter4, nullptr);
}
/// Feature: DBpedia.
/// Description: read data with pipeline from test file.
/// Expectation: the data is processed successfully.
/// Feature: DBpediaDataset
/// Description: Test DBpediaDataset in pipeline mode
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestDBpediaDatasetWithPipeline) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestDBpediaDatasetWithPipeline.";
@ -409,9 +409,9 @@ TEST_F(MindDataTestPipeline, TestDBpediaDatasetWithPipeline) {
iter->Stop();
}
/// Feature: DBpedia.
/// Description: test with shuffle files.
/// Expectation: the data is processed successfully.
/// Feature: DBpediaDataset
/// Description: Test DBpediaDataset with ShuffleMode::kFiles
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestDBpediaDatasetShuffleFilesA) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestDBpediaDatasetShuffleFilesA.";
@ -470,9 +470,9 @@ TEST_F(MindDataTestPipeline, TestDBpediaDatasetShuffleFilesA) {
GlobalContext::config_manager()->set_num_parallel_workers(original_num_parallel_workers);
}
/// Feature: DBpedia.
/// Description: test with shuffle in file.
/// Expectation: the data is processed successfully.
/// Feature: DBpediaDataset
/// Description: Test DBpediaDataset with ShuffleMode::kInfile
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestDBpediaDatasetShuffleFilesB) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestDBpediaDatasetShuffleFilesB.";
@ -528,9 +528,9 @@ TEST_F(MindDataTestPipeline, TestDBpediaDatasetShuffleFilesB) {
GlobalContext::config_manager()->set_num_parallel_workers(original_num_parallel_workers);
}
/// Feature: DBpedia.
/// Description: test with global shuffle.
/// Expectation: the data is processed successfully.
/// Feature: DBpediaDataset
/// Description: Test DBpediaDataset with ShuffleMode::kGlobal
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestDBpediaDatasetShuffleGlobal) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestDBpediaDatasetShuffleFilesGlobal.";

View File

@ -1,5 +1,5 @@
/**
* Copyright 2021 Huawei Technologies Co., Ltd
* Copyright 2021-2022 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -23,9 +23,9 @@ class MindDataTestPipeline : public UT::DatasetOpTesting {
protected:
};
/// Feature: DIV2KDataset.
/// Description: test basic usage of DIV2KDataset.
/// Expectation: get correct number of data.
/// Feature: DIV2KDataset
/// Description: Test basic usage of DIV2KDataset
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestDIV2KBasic) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestDIV2KBasic.";
@ -63,9 +63,9 @@ TEST_F(MindDataTestPipeline, TestDIV2KBasic) {
iter->Stop();
}
/// Feature: DIV2KDatasetWithPipeline.
/// Description: test usage of DIV2KDataset with pipeline.
/// Expectation: get correct number of data.
/// Feature: DIV2KDataset
/// Description: Test usage of DIV2KDataset with pipeline
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestDIV2KBasicWithPipeline) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestDIV2KBasicWithPipeline.";
@ -124,9 +124,9 @@ TEST_F(MindDataTestPipeline, TestDIV2KBasicWithPipeline) {
iter->Stop();
}
/// Feature: DIV2KIteratorOneColumn.
/// Description: test iterator of DIV2KDataset with only the "hr_image" column.
/// Expectation: get correct data.
/// Feature: DIV2KDataset
/// Description: Test iterator of DIV2KDataset with only the hr_image column
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestDIV2KIteratorOneColumn) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestDIV2KIteratorOneColumn.";
// Create a DIV2K Dataset
@ -167,9 +167,9 @@ TEST_F(MindDataTestPipeline, TestDIV2KIteratorOneColumn) {
iter->Stop();
}
/// Feature: DIV2KIteratorWrongColumn.
/// Description: test iterator of DIV2KDataset with wrong column.
/// Expectation: get none piece of data.
/// Feature: DIV2KDataset
/// Description: Test iterator of DIV2KDataset with wrong column
/// Expectation: Error message is logged, and CreateIterator for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestDIV2KIteratorWrongColumn) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestDIV2KIteratorWrongColumn.";
// Create a DIV2K Dataset
@ -186,9 +186,9 @@ TEST_F(MindDataTestPipeline, TestDIV2KIteratorWrongColumn) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: DIV2KDatasetGetters.
/// Description: test usage of getters DIV2KDataset.
/// Expectation: get correct number of data and correct tensor shape.
/// Feature: DIV2KDataset
/// Description: Test usage of DIV2KDataset Getters method
/// Expectation: Get correct number of data and correct tensor shape
TEST_F(MindDataTestPipeline, TestDIV2KGetters) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestDIV2KGetters.";
@ -213,9 +213,9 @@ TEST_F(MindDataTestPipeline, TestDIV2KGetters) {
EXPECT_EQ(ds2->GetColumnNames(), column_names);
}
/// Feature: DIV2KDecode.
/// Description: test usage of DIV2KDecode.
/// Expectation: get correct number of data and correct tensor shape.
/// Feature: DIV2KDataset
/// Description: Test usage of DIV2KDataset with Decode
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestDIV2KDecode) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestDIV2KDecode.";
@ -257,9 +257,9 @@ TEST_F(MindDataTestPipeline, TestDIV2KDecode) {
iter->Stop();
}
/// Feature: DIV2KNumSampler.
/// Description: test usage of DIV2KDataset with num sampler.
/// Expectation: get correct piece of data.
/// Feature: DIV2KDataset
/// Description: Test usage of DIV2KDataset with num sampler
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestDIV2KNumSamplers) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestDIV2KNumSamplers.";
@ -300,9 +300,9 @@ TEST_F(MindDataTestPipeline, TestDIV2KNumSamplers) {
iter->Stop();
}
/// Feature: DIV2KError.
/// Description: test failure of DIV2K Dataset.
/// Expectation: get none piece of data.
/// Feature: DIV2KDataset
/// Description: Test DIV2KDataset with non-existing dataset directory and other invalid inputs
/// Expectation: Error message is logged, and CreateIterator for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestDIV2KError) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestDIV2KError.";
@ -366,9 +366,9 @@ TEST_F(MindDataTestPipeline, TestDIV2KError) {
EXPECT_EQ(iter5, nullptr);
}
/// Feature: DIV2KWithNullSamplerError.
/// Description: test failure of DIV2K Dataset.
/// Expectation: get none piece of data.
/// Feature: DIV2KDataset
/// Description: Test DIV2KDataset with null sampler
/// Expectation: Error message is logged, and CreateIterator for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestDIV2KWithNullSamplerError) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestDIV2KWithNullSamplerError.";

View File

@ -1,5 +1,5 @@
/**
* Copyright 2021 Huawei Technologies Co., Ltd
* Copyright 2021-2022 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -26,9 +26,9 @@ class MindDataTestPipeline : public UT::DatasetOpTesting {
protected:
};
/// Feature: EMnistTrainDataset.
/// Description: test basic usage of EMnistTrainDataset.
/// Expectation: get correct number of data.
/// Feature: EMnistDataset
/// Description: Test basic usage of EMnistTrainDataset with train dataset
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestEMnistTrainDataset) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestEMnistTrainDataset.";
@ -63,9 +63,9 @@ TEST_F(MindDataTestPipeline, TestEMnistTrainDataset) {
iter->Stop();
}
/// Feature: EMnistTestDataset.
/// Description: test basic usage of EMnistTestDataset.
/// Expectation: get correct number of data.
/// Feature: EMnistDataset
/// Description: Test basic usage of EMnistTestDataset with test dataset
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestEMnistTestDataset) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestEMnistTestDataset.";
@ -101,9 +101,9 @@ TEST_F(MindDataTestPipeline, TestEMnistTestDataset) {
iter->Stop();
}
/// Feature: EMnistTrainDatasetWithPipeline.
/// Description: test usage of EMnistTrainDataset with pipeline.
/// Expectation: get correct number of data.
/// Feature: EMnistDataset
/// Description: Test usage of EMnistTrainDataset with pipeline with train dataset
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestEMnistTrainDatasetWithPipeline) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestEMnistTrainDatasetWithPipeline.";
@ -160,9 +160,9 @@ TEST_F(MindDataTestPipeline, TestEMnistTrainDatasetWithPipeline) {
iter->Stop();
}
/// Feature: TestEMnistTestDatasetWithPipeline.
/// Description: test usage of EMnistTrainDataset with pipeline.
/// Expectation: get correct number of data.
/// Feature: EMnistDataset
/// Description: Test usage of EMnistTrainDataset with pipeline.
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestEMnistTestDatasetWithPipeline) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestEMnistTestDatasetWithPipeline.";
@ -219,9 +219,9 @@ TEST_F(MindDataTestPipeline, TestEMnistTestDatasetWithPipeline) {
iter->Stop();
}
/// Feature: EMnistIteratorOneColumn.
/// Description: test iterator of EMnistDataset with only the "image" column.
/// Expectation: get correct data.
/// Feature: EMnistDataset
/// Description: Test iterator of EMnistDataset with only the "image" column.
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestEMnistIteratorOneColumn) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestEMnistIteratorOneColumn.";
// Create a EMnist Dataset
@ -261,9 +261,9 @@ TEST_F(MindDataTestPipeline, TestEMnistIteratorOneColumn) {
iter->Stop();
}
/// Feature: EMnistIteratorWrongColumn.
/// Description: test iterator of EMnistDataset with wrong column.
/// Expectation: get none piece of data.
/// Feature: EMnistDataset
/// Description: Test iterator of EMnistDataset with wrong column.
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestEMnistIteratorWrongColumn) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestEMnistIteratorWrongColumn.";
// Create a EMnist Dataset
@ -305,9 +305,9 @@ TEST_F(MindDataTestPipeline, TestGetEMnistTestDatasetSize) {
EXPECT_EQ(ds->GetDatasetSize(), 10);
}
/// Feature: EMnistTrainDatasetGetters.
/// Description: test usage of getters EMnistTrainDataset.
/// Expectation: get correct number of data and correct tensor shape.
/// Feature: EMnistDataset
/// Description: Test usage of getters EMnistTrainDataset.
/// Expectation: Get correct number of data and correct tensor shape.
TEST_F(MindDataTestPipeline, TestEMnistTrainDatasetGetters) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestEMnistTrainDatasetGetters.";
@ -346,9 +346,9 @@ TEST_F(MindDataTestPipeline, TestEMnistTrainDatasetGetters) {
EXPECT_EQ(ds->GetDatasetSize(), 10);
}
/// Feature: EMnistTestDatasetGetters.
/// Description: test usage of getters EMnistTrainDataset.
/// Expectation: get correct number of data and correct tensor shape.
/// Feature: EMnistDataset
/// Description: Test usage of getters EMnistTrainDataset.
/// Expectation: Get correct number of data and correct tensor shape.
TEST_F(MindDataTestPipeline, TestEMnistTestDatasetGetters) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestEMnistTestDatasetGetters.";
@ -387,9 +387,9 @@ TEST_F(MindDataTestPipeline, TestEMnistTestDatasetGetters) {
EXPECT_EQ(ds->GetDatasetSize(), 10);
}
/// Feature: EMnistDatasetWithInvalidDir.
/// Description: test failure of EMnistDataset.
/// Expectation: get none piece of data.
/// Feature: EMnistDataset
/// Description: Test failure of EMnistDataset with invalid directory
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestEMnistDatasetWithInvalidDir) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestEMnistDatasetWithInvalidDir.";
@ -403,9 +403,9 @@ TEST_F(MindDataTestPipeline, TestEMnistDatasetWithInvalidDir) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: EMnistDatasetWithInvalidUsage.
/// Description: test failure of EMnistDataset with invalid usage.
/// Expectation: get none piece of data.
/// Feature: EMnistDataset
/// Description: Test failure of EMnistDataset with invalid usage.
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestEMnistDatasetWithInvalidUsage) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestEMnistDatasetWithInvalidUsage.";
@ -420,9 +420,9 @@ TEST_F(MindDataTestPipeline, TestEMnistDatasetWithInvalidUsage) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: EMnistDatasetWithInvalidName.
/// Description: test failure of EMnistDataset with invalid name.
/// Expectation: get none piece of data.
/// Feature: EMnistDataset
/// Description: Test failure of EMnistDataset with invalid name.
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestEMnistDatasetWithInvalidName) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestEMnistDatasetWithInvalidName.";
@ -437,9 +437,9 @@ TEST_F(MindDataTestPipeline, TestEMnistDatasetWithInvalidName) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: TestEMnistDatasetWithNullSampler.
/// Description: test failure of EMnistDataset with null sampler.
/// Expectation: get none piece of data.
/// Feature: EMnistDataset
/// Description: Test failure of EMnistDataset with null sampler.
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestEMnistDatasetWithNullSampler) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestEMnistDatasetWithNullSampler.";

View File

@ -26,8 +26,8 @@ class MindDataTestPipeline : public UT::DatasetOpTesting {
};
/// Feature: EnWik9Dataset
/// Description: test EnWik9Dataset in pipeline mode
/// Expectation: the number of samples is proper
/// Description: Test EnWik9Dataset basic usage
/// Expectation: The number of samples is proper
TEST_F(MindDataTestPipeline, TestEnWik9DatasetBasic) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestEnWik9DatasetBasic.";
// Test EnWik9 Dataset with single text file and many default inputs.
@ -88,8 +88,8 @@ TEST_F(MindDataTestPipeline, TestEnWik9DatasetBasic) {
}
/// Feature: EnWik9Dataset
/// Description: test EnWik9Dataset in pipeline mode
/// Expectation: the number of samples is proper
/// Description: Test EnWik9Dataset basic usage with repeat op
/// Expectation: The number of samples is proper
TEST_F(MindDataTestPipeline, TestEnWik9DatasetBasicAndRepeat) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestEnWik9DatasetBasicAndRepeat.";
// Test EnWik9 Dataset with single enwik9 file and many default inputs.
@ -155,8 +155,8 @@ TEST_F(MindDataTestPipeline, TestEnWik9DatasetBasicAndRepeat) {
}
/// Feature: EnWik9Dataset
/// Description: test EnWik9Dataset in pipeline mode
/// Expectation: the number of samples is proper
/// Description: Test EnWik9Dataset Getters method
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestEnWik9Getters) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestEnWik9Getters.";
// Test EnWik9 Dataset with single text file and many default inputs.
@ -191,8 +191,8 @@ TEST_F(MindDataTestPipeline, TestEnWik9Getters) {
}
/// Feature: EnWik9Dataset
/// Description: test EnWik9Dataset in pipeline mode
/// Expectation: the argument named dataset_file is incorrect
/// Description: Test EnWik9Dataset with non-existent dataset_files
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestEnWik9DatasetFailNoExistentPath) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestEnWik9DatasetFailNoExistentPath.";
@ -209,8 +209,8 @@ TEST_F(MindDataTestPipeline, TestEnWik9DatasetFailNoExistentPath) {
}
/// Feature: EnWik9Dataset
/// Description: test EnWik9Dataset in pipeline mode
/// Expectation: the data of samples is proper
/// Description: Test EnWik9Dataset with ShuffleMode::kFalse
/// Expectation: The data of samples is proper
TEST_F(MindDataTestPipeline, TestEnWik9DatasetShuffleFalse1A) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestEnWik9DatasetShuffleFalse1A.";
// Test EnWik9 Dataset with two enwik9 files and no shuffle, num_parallel_workers=1.
@ -282,8 +282,8 @@ TEST_F(MindDataTestPipeline, TestEnWik9DatasetShuffleFalse1A) {
}
/// Feature: EnWik9Dataset
/// Description: test EnWik9Dataset in pipeline mode
/// Expectation: the data of samples is proper
/// Description: Test EnWik9Dataset with ShuffleMode::kFalse and with num_shards and shard_id
/// Expectation: The data of samples is proper
TEST_F(MindDataTestPipeline, TestEnWik9DatasetShuffleFalse4Shard) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestEnWik9DatasetShuffleFalse4Shard.";
// Test EnWik9 Dataset with one enwik9 files and no shuffle, num_parallel_workers=4, shard coverage.
@ -354,8 +354,8 @@ TEST_F(MindDataTestPipeline, TestEnWik9DatasetShuffleFalse4Shard) {
}
/// Feature: EnWik9Dataset
/// Description: test EnWik9Dataset in pipeline mode
/// Expectation: the data of samples is proper
/// Description: Test EnWik9Dataset with ShuffleMode::kGlobal
/// Expectation: The data of samples is proper
TEST_F(MindDataTestPipeline, TestEnWik9DatasetShuffleGlobal1A) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestEnWik9DatasetShuffleGlobal1A.";
// Test EnWik9 Dataset with one enwik9 file, global shuffle, num_parallel_workers=1.

View File

@ -1,5 +1,5 @@
/**
* Copyright 2021 Huawei Technologies Co., Ltd
* Copyright 2021-2022 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -27,8 +27,8 @@ class MindDataTestPipeline : public UT::DatasetOpTesting {
};
/// Feature: FakeImageDataset
/// Description: test FakeImage
/// Expectation: get correct FakeImage dataset
/// Description: Test FakeImageDataset basic usage
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestFakeImageDataset) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestFakeImageDataset.";
@ -62,9 +62,9 @@ TEST_F(MindDataTestPipeline, TestFakeImageDataset) {
iter->Stop();
}
/// Feature: FakeImageDatasetWithPipeline
/// Description: test FakeImage in pipeline mode
/// Expectation: get correct FakeImage dataset
/// Feature: FakeImageDataset
/// Description: Test FakeImageDataset in pipeline mode
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestFakeImageDatasetWithPipeline) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestFakeImageDatasetWithPipeline.";
@ -118,9 +118,10 @@ TEST_F(MindDataTestPipeline, TestFakeImageDatasetWithPipeline) {
// Manually terminate the pipeline
iter->Stop();
}
/// Feature: FakeImageIteratorOneColumn.
/// Description: test iterator of FakeImageDataset with only the "image" column.
/// Expectation: get correct data.
/// Feature: FakeImageDataset
/// Description: Test iterator of FakeImageDataset with only the image column
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestFakeImageIteratorOneColumn) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestFakeImageIteratorOneColumn.";
// Create a FakeImage Dataset
@ -159,9 +160,9 @@ TEST_F(MindDataTestPipeline, TestFakeImageIteratorOneColumn) {
iter->Stop();
}
/// Feature: FakeImageIteratorWrongColumn.
/// Description: test iterator of FakeImageDataset with wrong column.
/// Expectation: get none piece of data.
/// Feature: FakeImageDataset
/// Description: Test iterator of FakeImageDataset with wrong column
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestFakeImageIteratorWrongColumn) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestFakeImageIteratorWrongColumn.";
// Create a FakeImage Dataset
@ -174,9 +175,9 @@ TEST_F(MindDataTestPipeline, TestFakeImageIteratorWrongColumn) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: GetFakeImageDatasetSize
/// Description: test GetDataSize of FakeImage
/// Expectation: get the correct size of FakeImage
/// Feature: FakeImageDataset
/// Description: Test FakeImageDataset GetDatasetSize
/// Expectation: Get the correct size of the dataset
TEST_F(MindDataTestPipeline, TestGetFakeImageDatasetSize) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestGetFakeImageDatasetSize.";
@ -187,9 +188,9 @@ TEST_F(MindDataTestPipeline, TestGetFakeImageDatasetSize) {
EXPECT_EQ(ds->GetDatasetSize(), 50);
}
/// Feature: FakeImageDatasetGetters
/// Description: test DatasetGetters of FakeImage
/// Expectation: getters of FakeImage get the correct value
/// Feature: FakeImageDataset
/// Description: Test FakeImageDataset Getters method
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestFakeImageDatasetGetters) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestFakeImageDatasetGetters.";
@ -227,9 +228,9 @@ TEST_F(MindDataTestPipeline, TestFakeImageDatasetGetters) {
EXPECT_EQ(ds->GetDatasetSize(), 50);
}
/// Feature: FakeImageDatasetWithInvalidNumImages
/// Description: test invalid num_images of FakeImage
/// Expectation: throw exception correctly
/// Feature: FakeImageDataset
/// Description: Test FakeImageDataset with invalid num_image
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestFakeImageDatasetWithInvalidNumImages) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestFakeImageDatasetWithInvalidNumImages.";
@ -243,9 +244,9 @@ TEST_F(MindDataTestPipeline, TestFakeImageDatasetWithInvalidNumImages) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: FakeImageDatasetWithInvalidImageSize
/// Description: test invalid image_size of FakeImage
/// Expectation: throw exception correctly
/// Feature: FakeImageDataset
/// Description: Test FakeImageDataset with invalid image_size
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestFakeImageDatasetWithInvalidImageSize) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestFakeImageDatasetWithInvalidImageSize.";
@ -259,9 +260,9 @@ TEST_F(MindDataTestPipeline, TestFakeImageDatasetWithInvalidImageSize) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: FakeImageDatasetWithInvalidNumClasses
/// Description: test invalid num_classes of FakeImage
/// Expectation: throw exception correctly
/// Feature: FakeImageDataset
/// Description: Test FakeImageDataset with invalid num_class
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestFakeImageDatasetWithInvalidNumClasses) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestFakeImageDatasetWithInvalidNumClasses.";
@ -275,9 +276,9 @@ TEST_F(MindDataTestPipeline, TestFakeImageDatasetWithInvalidNumClasses) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: FakeImageDatasetWithNullSampler
/// Description: test FakeImage dataset with null sampler
/// Expectation: dataset is null
/// Feature: FakeImageDataset
/// Description: Test FakeImageDataset with null sampler
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestFakeImageDatasetWithNullSampler) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestFakeImageDatasetWithNullSampler.";

View File

@ -1,5 +1,5 @@
/**
* Copyright 2021 Huawei Technologies Co., Ltd
* Copyright 2021-2022 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -25,9 +25,9 @@ class MindDataTestPipeline : public UT::DatasetOpTesting {
protected:
};
/// Feature: FashionMnistTestDataset.
/// Description: test basic usage of FashionMnistTestDataset.
/// Expectation: get correct data.
/// Feature: FashionMnistDataset
/// Description: Test basic usage of FashionMnistDataset
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestFashionMnistTestDataset) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestFashionMnistTestDataset.";
@ -63,9 +63,9 @@ TEST_F(MindDataTestPipeline, TestFashionMnistTestDataset) {
iter->Stop();
}
/// Feature: FashionMnistTestDatasetWithPipeline.
/// Description: test FashionMnistTestDataset with pipeline.
/// Expectation: get correct data.
/// Feature: FashionMnistDataset
/// Description: Test FashionMnistDataset in pipeline mode
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestFashionMnistTestDatasetWithPipeline) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestFashionMnistTestDatasetWithPipeline.";
@ -122,9 +122,9 @@ TEST_F(MindDataTestPipeline, TestFashionMnistTestDatasetWithPipeline) {
iter->Stop();
}
/// Feature: FashionMnistIteratorOneColumn.
/// Description: test iterator of FashionMnistDataset with only the "image" column.
/// Expectation: get correct data.
/// Feature: FashionMnistDataset
/// Description: Test iterator of FashionMnistDataset with only the image column.
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestFashionMnistIteratorOneColumn) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestFashionMnistIteratorOneColumn.";
// Create a FashionMnist Dataset
@ -164,9 +164,9 @@ TEST_F(MindDataTestPipeline, TestFashionMnistIteratorOneColumn) {
iter->Stop();
}
/// Feature: FashionMnistTestDatasetSize.
/// Description: test usage of get the size of FashionMnistTestDataset.
/// Expectation: get correct data.
/// Feature: FashionMnistDataset
/// Description: Test FashionMnistDataset GetDatasetSize
/// Expectation: Correct size of dataset
TEST_F(MindDataTestPipeline, TestGetFashionMnistTestDatasetSize) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestGetFashionMnistTestDatasetSize.";
@ -179,9 +179,9 @@ TEST_F(MindDataTestPipeline, TestGetFashionMnistTestDatasetSize) {
EXPECT_EQ(ds->GetDatasetSize(), 10000);
}
/// Feature: FashionMnistTestDatasetGetters.
/// Description: test DatasetGetters of FashionMnistTestDataset.
/// Expectation: get correct the value.
/// Feature: FashionMnistDataset
/// Description: Test FashionMnistDataset Getters method
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestFashionMnistTestDatasetGetters) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestFashionMnistTestDatasetGetters.";
@ -220,9 +220,9 @@ TEST_F(MindDataTestPipeline, TestFashionMnistTestDatasetGetters) {
EXPECT_EQ(ds->GetDatasetSize(), 10000);
}
/// Feature: FashionMnistIteratorWrongColumn.
/// Description: test iterator of FashionMnistDataset with wrong column.
/// Expectation: get none piece of data.
/// Feature: FashionMnistDataset
/// Description: Test iterator of FashionMnistDataset with wrong column
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestFashionMnistIteratorWrongColumn) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestFashionMnistIteratorOneColumn.";
// Create a FashionMnist Dataset
@ -236,9 +236,9 @@ TEST_F(MindDataTestPipeline, TestFashionMnistIteratorWrongColumn) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: FashionMnistDatasetFail.
/// Description: test failure of FashionMnistDataset.
/// Expectation: get none piece of data.
/// Feature: FashionMnistDataset
/// Description: Test FashionMnistDataset with empty string as the folder path
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestFashionMnistDatasetFail) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestFashionMnistDatasetFail.";
@ -252,9 +252,9 @@ TEST_F(MindDataTestPipeline, TestFashionMnistDatasetFail) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: FashionMnistDatasetWithInvalidUsageFail.
/// Description: test FashionMnistDataset with invalid usage.
/// Expectation: get none piece of data.
/// Feature: FashionMnistDataset
/// Description: Test FashionMnistDataset with invalid usage
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestFashionMnistDatasetWithInvalidUsageFail) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestFashionMnistDatasetWithInvalidUsageFail.";
@ -269,9 +269,9 @@ TEST_F(MindDataTestPipeline, TestFashionMnistDatasetWithInvalidUsageFail) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: FashionMnistDatasetWithNullSamplerFail.
/// Description: test FashionMnistDataset with null sampler.
/// Expectation: get none piece of data.
/// Feature: FashionMnistDataset
/// Description: Test FashionMnistDataset with null sampler
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestFashionMnistDatasetWithNullSamplerFail) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestFashionMnistUDatasetWithNullSamplerFail.";

View File

@ -1,5 +1,5 @@
/**
* Copyright 2021 Huawei Technologies Co., Ltd
* Copyright 2021-2022 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -23,9 +23,9 @@ class MindDataTestPipeline : public UT::DatasetOpTesting {
protected:
};
/// Feature: FlickrBasic.
/// Description: test basic usage of FlickrDataset.
/// Expectation: get correct number of data.
/// Feature: FlickrDataset
/// Description: Test basic usage of FlickrDataset
/// Expectation: Get correct number of data
TEST_F(MindDataTestPipeline, TestFlickrBasic) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestFlickrBasic.";
@ -59,9 +59,9 @@ TEST_F(MindDataTestPipeline, TestFlickrBasic) {
iter->Stop();
}
/// Feature: FlickrBasicWithPipeline.
/// Description: test usage of FlickrDataset with pipeline.
/// Expectation: get correct number of data.
/// Feature: FlickrDataset
/// Description: Test usage of FlickrDataset with pipeline mode
/// Expectation: Get correct number of data
TEST_F(MindDataTestPipeline, TestFlickrBasicWithPipeline) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestFlickrBasicWithPipeline.";
@ -116,9 +116,9 @@ TEST_F(MindDataTestPipeline, TestFlickrBasicWithPipeline) {
iter->Stop();
}
/// Feature: FlickrIteratorOneColumn.
/// Description: test iterator of FlickrDataset with only the "image" column.
/// Expectation: get correct data.
/// Feature: FlickrDataset
/// Description: Test iterator of FlickrDataset with only the "image" column
/// Expectation: Get correct data
TEST_F(MindDataTestPipeline, TestFlickrIteratorOneColumn) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestFlickrIteratorOneColumn.";
std::string dataset_path = datasets_root_path_ + "/testFlickrData/flickr30k/flickr30k-images";
@ -158,9 +158,9 @@ TEST_F(MindDataTestPipeline, TestFlickrIteratorOneColumn) {
iter->Stop();
}
/// Feature: FlickrIteratorWrongColumn.
/// Description: test iterator of FlickrDataset with wrong column.
/// Expectation: get none piece of data.
/// Feature: FlickrDataset
/// Description: Test iterator of FlickrDataset with wrong column
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestFlickrIteratorWrongColumn) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestFlickrIteratorWrongColumn.";
std::string dataset_path = datasets_root_path_ + "/testFlickrData/flickr30k/flickr30k-images";
@ -197,9 +197,9 @@ TEST_F(MindDataTestPipeline, TestFlickrGetters) {
EXPECT_EQ(ds2->GetColumnNames(), column_names);
}
/// Feature: FlickrAnnotations.
/// Description: test usage of FlickrAnnotations.
/// Expectation: get correct number of data.
/// Feature: FlickrDataset
/// Description: Test usage of FlickrAnnotations
/// Expectation: Get correct number of data
TEST_F(MindDataTestPipeline, TestFlickrAnnotations) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestFlickrGetters.";
@ -246,9 +246,9 @@ TEST_F(MindDataTestPipeline, TestFlickrAnnotations) {
iter->Stop();
}
/// Feature: FlickrDecode.
/// Description: test usage of FlickrDecode.
/// Expectation: get correct number of data.
/// Feature: FlickrDataset
/// Description: Test usage of FlickrDataset with RandomSampler
/// Expectation: Get correct number of data
TEST_F(MindDataTestPipeline, TestFlickrDecode) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestFlickrDecode.";
@ -284,9 +284,9 @@ TEST_F(MindDataTestPipeline, TestFlickrDecode) {
iter->Stop();
}
/// Feature: FlickrNumSamplers.
/// Description: test usage of FlickrDataset with num sampler.
/// Expectation: get correct piece of data.
/// Feature: FlickrDataset
/// Description: Test usage of FlickrDataset with SequentialSampler
/// Expectation: Get correct piece of data
TEST_F(MindDataTestPipeline, TestFlickrNumSamplers) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestFlickrNumSamplers.";
@ -325,9 +325,9 @@ TEST_F(MindDataTestPipeline, TestFlickrNumSamplers) {
iter->Stop();
}
/// Feature: FlickrError.
/// Description: test failure of Flickr Dataset.
/// Expectation: get none piece of data.
/// Feature: FlickrDataset
/// Description: Test FlickrDataset with invalid inputs
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestFlickrError) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestFlickrError.";
@ -370,9 +370,9 @@ TEST_F(MindDataTestPipeline, TestFlickrError) {
EXPECT_EQ(iter3, nullptr);
}
/// Feature: FlickrWithNullSamplerError.
/// Description: test failure of FlickrDataset with null sampler.
/// Expectation: get none piece of data.
/// Feature: FlickrDataset
/// Description: Test FlickrDataset with null sampler
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestFlickrWithNullSamplerError) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestFlickrWithNullSamplerError.";

View File

@ -26,8 +26,8 @@ class MindDataTestPipeline : public UT::DatasetOpTesting {
};
/// Feature: GTZANDataset
/// Description: test GTZAN
/// Expectation: get correct GTZAN dataset
/// Description: Test GTZAN
/// Expectation: Get correct GTZAN dataset
TEST_F(MindDataTestPipeline, TestGTZANBasic) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestGTZANBasic.";
@ -78,8 +78,8 @@ TEST_F(MindDataTestPipeline, TestGTZANBasic) {
}
/// Feature: GTZANDataset
/// Description: test GTZAN with Pipeline
/// Expectation: get correct GTZAN dataset
/// Description: Test GTZAN with Pipeline
/// Expectation: Get correct GTZAN dataset
TEST_F(MindDataTestPipeline, TestGTZANBasicWithPipeline) {
MS_LOG(INFO) << "Doing DataSetOpBatchTest-TestGTZANBasicWithPipeline.";
@ -136,8 +136,8 @@ TEST_F(MindDataTestPipeline, TestGTZANBasicWithPipeline) {
}
/// Feature: GTZANDataset
/// Description: test GTZAN with invalid directory
/// Expectation: get correct GTZAN dataset
/// Description: Test GTZAN with invalid directory
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestGTZANError) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestGTZANError.";
@ -161,8 +161,8 @@ TEST_F(MindDataTestPipeline, TestGTZANError) {
}
/// Feature: GTZANDataset
/// Description: test GTZAN with Getters
/// Expectation: dataset is null
/// Description: Test GTZAN with Getters
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestGTZANGetters) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestGTZANGetters.";
@ -188,8 +188,8 @@ TEST_F(MindDataTestPipeline, TestGTZANGetters) {
}
/// Feature: GTZANDataset
/// Description: test GTZAN dataset with invalid usage
/// Expectation: dataset is null
/// Description: Test GTZAN dataset with invalid usage
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestGTZANWithInvalidUsageError) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestGTZANWithInvalidUsageError.";
@ -212,8 +212,8 @@ TEST_F(MindDataTestPipeline, TestGTZANWithInvalidUsageError) {
}
/// Feature: GTZANDataset
/// Description: test GTZAN dataset with null sampler
/// Expectation: dataset is null
/// Description: Test GTZAN dataset with null sampler
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestGTZANWithNullSamplerError) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestGTZANWithNullSamplerError.";
@ -229,8 +229,8 @@ TEST_F(MindDataTestPipeline, TestGTZANWithNullSamplerError) {
}
/// Feature: GTZANDataset
/// Description: test GTZAN with sequential sampler
/// Expectation: get correct GTZAN dataset
/// Description: Test GTZAN with sequential sampler
/// Expectation: Get correct GTZAN dataset
TEST_F(MindDataTestPipeline, TestGTZANNumSamplers) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestGTZANWithSequentialSampler.";

View File

@ -1,5 +1,5 @@
/**
* Copyright 2021 Huawei Technologies Co., Ltd
* Copyright 2021-2022 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -27,9 +27,9 @@ class MindDataTestPipeline : public UT::DatasetOpTesting {
protected:
};
/// Feature: Test IMDB Dataset.
/// Description: read IMDB data and get all data.
/// Expectation: the data is processed successfully.
/// Feature: IMDBDataset
/// Description: Test IMBDDataset basic usage
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestIMDBBasic) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestIMDBBasic.";
@ -64,9 +64,9 @@ TEST_F(MindDataTestPipeline, TestIMDBBasic) {
iter->Stop();
}
/// Feature: Test IMDB Dataset.
/// Description: read IMDB data and get train data.
/// Expectation: the data is processed successfully.
/// Feature: IMDBDataset
/// Description: Test IMBDDataset with train dataset
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestIMDBTrain) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestIMDBTrain.";
@ -101,9 +101,9 @@ TEST_F(MindDataTestPipeline, TestIMDBTrain) {
iter->Stop();
}
/// Feature: Test IMDB Dataset.
/// Description: read IMDB data and get test data.
/// Expectation: the data is processed successfully.
/// Feature: IMDBDataset
/// Description: Test IMBDDataset with test dataset
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestIMDBTest) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestIMDBTest.";
@ -138,9 +138,9 @@ TEST_F(MindDataTestPipeline, TestIMDBTest) {
iter->Stop();
}
/// Feature: Test IMDB Dataset.
/// Description: read IMDB data and test pipeline.
/// Expectation: the data is processed successfully.
/// Feature: IMDBDataset
/// Description: Test IMBDDataset in pipeline mode
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestIMDBBasicWithPipeline) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestIMDBBasicWithPipeline.";
@ -189,9 +189,9 @@ TEST_F(MindDataTestPipeline, TestIMDBBasicWithPipeline) {
iter->Stop();
}
/// Feature: IMDBIteratorOneColumn.
/// Description: test iterator of IMDBDataset with only the "text" column.
/// Expectation: get correct data.
/// Feature: IMDBDataset
/// Description: Test iterator of IMDBDataset with only the text column.
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestIMDBIteratorOneColumn) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestIMDBIteratorOneColumn.";
std::string dataset_path = datasets_root_path_ + "/testIMDBDataset";
@ -231,9 +231,9 @@ TEST_F(MindDataTestPipeline, TestIMDBIteratorOneColumn) {
iter->Stop();
}
/// Feature: IMDBIteratorWrongColumn.
/// Description: test iterator of IMDBDataset with wrong column.
/// Expectation: get none piece of data.
/// Feature: IMDBDataset
/// Description: Test iterator of IMDBDataset with wrong column
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestIMDBIteratorWrongColumn) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestIMDBIteratorWrongColumn.";
std::string dataset_path = datasets_root_path_ + "/testIMDBDataset";
@ -249,9 +249,9 @@ TEST_F(MindDataTestPipeline, TestIMDBIteratorWrongColumn) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: Test IMDB Dataset.
/// Description: read IMDB data with GetDatasetSize, GetColumnNames, GetBatchSize.
/// Expectation: the data is processed successfully.
/// Feature: IMDBDataset
/// Description: Test IMDBDataset Getters method
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestIMDBGetters) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestIMDBGetters.";
@ -272,9 +272,9 @@ TEST_F(MindDataTestPipeline, TestIMDBGetters) {
EXPECT_EQ(ds1->GetBatchSize(), 1);
}
/// Feature: Test IMDB Dataset.
/// Description: read IMDB data with errors.
/// Expectation: the data is processed successfully.
/// Feature: IMDBDataset
/// Description: Test IMDBDataset with invalid inputs
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestIMDBError) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestIMDBError.";
@ -300,9 +300,9 @@ TEST_F(MindDataTestPipeline, TestIMDBError) {
EXPECT_EQ(iter1, nullptr);
}
/// Feature: Test IMDB Dataset.
/// Description: read IMDB data with Null SamplerError.
/// Expectation: the data is processed successfully.
/// Feature: IMDBDataset
/// Description: Test IMDBDataset with null sampler
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestIMDBWithNullSamplerError) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestIMDBWithNullSamplerError.";

View File

@ -1,5 +1,5 @@
/**
* Copyright 2020-2021 Huawei Technologies Co., Ltd
* Copyright 2020-2022 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -22,6 +22,9 @@ class MindDataTestPipeline : public UT::DatasetOpTesting {
protected:
};
/// Feature: Iterator
/// Description: Test iterator with an empty column
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestIteratorEmptyColumn) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestIteratorEmptyColumn.";
// Create a Cifar10 Dataset
@ -59,6 +62,9 @@ TEST_F(MindDataTestPipeline, TestIteratorEmptyColumn) {
iter->Stop();
}
/// Feature: Iterator
/// Description: Test iterator with one column (image column)
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestIteratorOneColumn) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestIteratorOneColumn.";
// Create a Mnist Dataset
@ -98,6 +104,9 @@ TEST_F(MindDataTestPipeline, TestIteratorOneColumn) {
iter->Stop();
}
/// Feature: Iterator
/// Description: Test iterator by reordering image and label column
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestIteratorReOrder) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestIteratorReOrder.";
// Create a Cifar10 Dataset
@ -137,6 +146,9 @@ TEST_F(MindDataTestPipeline, TestIteratorReOrder) {
iter->Stop();
}
/// Feature: Iterator
/// Description: Test iterator with 2 columns (image and bbox)
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestIteratorTwoColumns) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestIteratorTwoColumns.";
// Create a VOC Dataset
@ -180,6 +192,9 @@ TEST_F(MindDataTestPipeline, TestIteratorTwoColumns) {
iter->Stop();
}
/// Feature: Iterator
/// Description: Test iterator with wrong column
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestIteratorWrongColumn) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestIteratorOneColumn.";
// Create a Mnist Dataset
@ -193,6 +208,9 @@ TEST_F(MindDataTestPipeline, TestIteratorWrongColumn) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: Iterator
/// Description: Test iterator with num_epochs
/// Expectation: The data is processed successfully and throw correct error when getting a row beyond limit
TEST_F(MindDataTestPipeline, TestIteratorNumEpoch) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestIteratorNumEpoch.";
@ -225,6 +243,9 @@ TEST_F(MindDataTestPipeline, TestIteratorNumEpoch) {
iter->Stop();
}
/// Feature: Iterator
/// Description: Test iterator with incorrect num_epochs value
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestIteratorNumEpochFail) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestIteratorNumEpochFail.";

View File

@ -1,5 +1,5 @@
/**
* Copyright 2021 Huawei Technologies Co., Ltd
* Copyright 2021-2022 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -24,8 +24,8 @@ class MindDataTestPipeline : public UT::DatasetOpTesting {
};
/// Feature: Test IWSLT2016 Dataset.
/// Description: read IWSLT2016Dataset data and get data.
/// Expectation: the data is processed successfully.
/// Description: Read IWSLT2016Dataset data and get data.
/// Expectation: The data is processed successfully.
TEST_F(MindDataTestPipeline, TestIWSLT2016DatasetBasic) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestIWSLT2016DatasetBasic.";
@ -71,8 +71,8 @@ TEST_F(MindDataTestPipeline, TestIWSLT2016DatasetBasic) {
}
/// Feature: Test IWSLT2016 Dataset.
/// Description: read IWSLT2016Dataset data and get data (usage=valid).
/// Expectation: the data is processed successfully.
/// Description: Read IWSLT2016Dataset data and get data (usage=valid).
/// Expectation: The data is processed successfully.
TEST_F(MindDataTestPipeline, TestIWSLT2016DatasetUsageValidBasic) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestIWSLT2016DatasetUsageValidBasic.";
@ -117,8 +117,8 @@ TEST_F(MindDataTestPipeline, TestIWSLT2016DatasetUsageValidBasic) {
}
/// Feature: Test IWSLT2016 Dataset.
/// Description: read IWSLT2016Dataset data and get data (usage=test).
/// Expectation: the data is processed successfully.
/// Description: Read IWSLT2016Dataset data and get data (usage=test).
/// Expectation: The data is processed successfully.
TEST_F(MindDataTestPipeline, TestIWSLT2016DatasetUsageTestBasic) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestIWSLT2016DatasetUsageTestBasic.";
@ -163,8 +163,8 @@ TEST_F(MindDataTestPipeline, TestIWSLT2016DatasetUsageTestBasic) {
}
/// Feature: Test IWSLT2016 Dataset.
/// Description: read IWSLT2016Dataset data and get data (usage=all).
/// Expectation: the data is processed successfully.
/// Description: Read IWSLT2016Dataset data and get data (usage=all).
/// Expectation: The data is processed successfully.
TEST_F(MindDataTestPipeline, TestIWSLT2016DatasetUsageAllBasic) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestIWSLT2016DatasetUsageAllBasic.";
@ -215,8 +215,8 @@ TEST_F(MindDataTestPipeline, TestIWSLT2016DatasetUsageAllBasic) {
}
/// Feature: Test IWSLT2016 Dataset.
/// Description: includes tests for shape, type, size.
/// Expectation: the data is processed successfully.
/// Description: Includes tests for shape, type, size.
/// Expectation: The data is processed successfully.
TEST_F(MindDataTestPipeline, TestIWSLT2016DatasetGetters) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestIWSLT2016DatasetGetters.";
@ -240,8 +240,8 @@ TEST_F(MindDataTestPipeline, TestIWSLT2016DatasetGetters) {
}
/// Feature: Test IWSLT2016 Dataset.
/// Description: test whether the interface meets expectations when NumSamples is equal to 2.
/// Expectation: the data is processed successfully.
/// Description: Test whether the interface meets expectations when NumSamples is equal to 2.
/// Expectation: The data is processed successfully.
TEST_F(MindDataTestPipeline, TestIWSLT2016DatasetNumSamples) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestIWSLT2016DatasetNumSamples.";
@ -287,8 +287,8 @@ TEST_F(MindDataTestPipeline, TestIWSLT2016DatasetNumSamples) {
}
/// Feature: Test IWSLT2016 Dataset.
/// Description: test interface in a distributed state.
/// Expectation: the data is processed successfully.
/// Description: Test interface in a distributed state.
/// Expectation: The data is processed successfully.
TEST_F(MindDataTestPipeline, TestIWSLT2016DatasetDistribution) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestIWSLT2016DatasetDistribution.";
@ -335,8 +335,8 @@ TEST_F(MindDataTestPipeline, TestIWSLT2016DatasetDistribution) {
}
/// Feature: Test IWSLT2016 Dataset.
/// Description: test the wrong input.
/// Expectation: unable to read in data.
/// Description: Test the wrong input.
/// Expectation: Unable to read in data.
TEST_F(MindDataTestPipeline, TestIWSLT2016DatasetFail) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestIWSLT2016DatasetFail.";
@ -422,8 +422,8 @@ TEST_F(MindDataTestPipeline, TestIWSLT2016DatasetFail) {
}
/// Feature: Test IWSLT2016 Dataset.
/// Description: test IWSLT2016 Dataset interface in pipeline.
/// Expectation: the data is processed successfully.
/// Description: Test IWSLT2016 Dataset interface in pipeline.
/// Expectation: The data is processed successfully.
TEST_F(MindDataTestPipeline, TestIWSLT2016DatasetBasicWithPipeline) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestIWSLT2016DatasetBasicWithPipeline.";
@ -482,8 +482,8 @@ TEST_F(MindDataTestPipeline, TestIWSLT2016DatasetBasicWithPipeline) {
}
/// Feature: Test IWSLT2016 Dataset.
/// Description: test IWSLT2016 Dataset interface with different ShuffleMode.
/// Expectation: the data is processed successfully.
/// Description: Test IWSLT2016 Dataset interface with different ShuffleMode.
/// Expectation: The data is processed successfully.
TEST_F(MindDataTestPipeline, TestIWSLT2016DatasetShuffleFilesA) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestIWSLT2016DatasetShuffleFilesA.";
@ -544,8 +544,8 @@ TEST_F(MindDataTestPipeline, TestIWSLT2016DatasetShuffleFilesA) {
}
/// Feature: Test IWSLT2016 Dataset.
/// Description: test IWSLT2016 Dataset interface with different ShuffleMode.
/// Expectation: the data is processed successfully.
/// Description: Test IWSLT2016 Dataset interface with different ShuffleMode.
/// Expectation: The data is processed successfully.
TEST_F(MindDataTestPipeline, TestIWSLT2016DatasetShuffleFilesB) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestIWSLT2016DatasetShuffleFilesB.";
@ -607,8 +607,8 @@ TEST_F(MindDataTestPipeline, TestIWSLT2016DatasetShuffleFilesB) {
}
/// Feature: Test IWSLT2016 Dataset.
/// Description: test IWSLT2016 Dataset interface with different ShuffleMode.
/// Expectation: the data is processed successfully.
/// Description: Test IWSLT2016 Dataset interface with different ShuffleMode.
/// Expectation: The data is processed successfully.
TEST_F(MindDataTestPipeline, TesIWSLT2016DatasetShuffleFilesGlobal) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TesIWSLT2016DatasetShuffleFilesGlobal.";
@ -670,8 +670,8 @@ TEST_F(MindDataTestPipeline, TesIWSLT2016DatasetShuffleFilesGlobal) {
}
/// Feature: Test IWSLT2017 Dataset.
/// Description: read IWSLT2017Dataset data and get data.
/// Expectation: the data is processed successfully.
/// Description: Read IWSLT2017Dataset data and get data.
/// Expectation: The data is processed successfully.
TEST_F(MindDataTestPipeline, TestIWSLT2017DatasetBasic) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestIWSLT2017DatasetBasic.";
@ -715,8 +715,8 @@ TEST_F(MindDataTestPipeline, TestIWSLT2017DatasetBasic) {
}
/// Feature: Test IWSLT2017 Dataset.
/// Description: read IWSLT2017Dataset data and get data (usage=valid).
/// Expectation: the data is processed successfully.
/// Description: Read IWSLT2017Dataset data and get data (usage=valid).
/// Expectation: The data is processed successfully.
TEST_F(MindDataTestPipeline, TestIWSLT2017DatasetUsageValidBasic) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestIWSLT2017DatasetUsageValidBasic.";
@ -761,8 +761,8 @@ TEST_F(MindDataTestPipeline, TestIWSLT2017DatasetUsageValidBasic) {
}
/// Feature: Test IWSLT2017 Dataset.
/// Description: read IWSLT2017Dataset data and get data (usage=test).
/// Expectation: the data is processed successfully.
/// Description: Read IWSLT2017Dataset data and get data (usage=test).
/// Expectation: The data is processed successfully.
TEST_F(MindDataTestPipeline, TestIWSLT2017DatasetUsageTestBasic) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestIWSLT2017DatasetUsageTestBasic.";
@ -807,8 +807,8 @@ TEST_F(MindDataTestPipeline, TestIWSLT2017DatasetUsageTestBasic) {
}
/// Feature: Test IWSLT2017 Dataset.
/// Description: read IWSLT2017Dataset data and get data (usage=all).
/// Expectation: the data is processed successfully.
/// Description: Read IWSLT2017Dataset data and get data (usage=all).
/// Expectation: The data is processed successfully.
TEST_F(MindDataTestPipeline, TestIWSLT2017DatasetUsageAllBasic) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestIWSLT2017DatasetUsageAllBasic.";
@ -857,8 +857,8 @@ TEST_F(MindDataTestPipeline, TestIWSLT2017DatasetUsageAllBasic) {
}
/// Feature: Test IWSLT2017 Dataset.
/// Description: test the wrong input.
/// Expectation: unable to read in data.
/// Description: Test the wrong input.
/// Expectation: Unable to read in data.
TEST_F(MindDataTestPipeline, TestIWSLT2017DatasetFail) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestIWSLT2017DatasetFail.";
@ -927,8 +927,8 @@ TEST_F(MindDataTestPipeline, TestIWSLT2017DatasetFail) {
}
/// Feature: Test IWSLT2017 Dataset.
/// Description: test IWSLT2017 Dataset interface in pipeline.
/// Expectation: the data is processed successfully.
/// Description: Test IWSLT2017 Dataset interface in pipeline.
/// Expectation: The data is processed successfully.
TEST_F(MindDataTestPipeline, TestIWSLT2017DatasetBasicWithPipeline) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestIWSLT2017DatasetBasicWithPipeline.";

View File

@ -1,5 +1,5 @@
/**
* Copyright 2021 Huawei Technologies Co., Ltd
* Copyright 2021-2022 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -27,9 +27,9 @@ class MindDataTestPipeline : public UT::DatasetOpTesting {
protected:
};
/// Feature: KITTIDatasetPipeline.
/// Description: test Pipeline of KITTI.
/// Expectation: get correct data.
/// Feature: KITTIDataset
/// Description: Test KITTIDataset in pipeline mode
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestKITTIPipeline) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestKITTIPipeline.";
@ -71,9 +71,9 @@ TEST_F(MindDataTestPipeline, TestKITTIPipeline) {
iter->Stop();
}
/// Feature: KITTITrainDatasetGetters.
/// Description: test usage of getters KITTITrainDataset.
/// Expectation: get correct number of data and correct tensor shape.
/// Feature: KITTIDataset
/// Description: Test KITTIDataset Getters method
/// Expectation: Get correct number of data and correct tensor shape
TEST_F(MindDataTestPipeline, TestKITTITrainDatasetGetters) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestKITTITrainDatasetGetters.";
@ -112,9 +112,9 @@ TEST_F(MindDataTestPipeline, TestKITTITrainDatasetGetters) {
EXPECT_EQ(ds->GetDatasetSize(), 2);
}
/// Feature: KITTIUsageTrainDecodeFalse.
/// Description: test get train dataset of KITTI and test decode.
/// Expectation: getters of KITTI get the correct value.
/// Feature: KITTIDataset
/// Description: Test KITTIDataset with train dataset and test decode
/// Expectation: Getters get the correct value
TEST_F(MindDataTestPipeline, TestKITTIUsageTrainDecodeFalse) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestKITTIGettersTrainDecodeFalse.";
@ -132,9 +132,9 @@ TEST_F(MindDataTestPipeline, TestKITTIUsageTrainDecodeFalse) {
EXPECT_EQ(ds->GetColumnNames(), column_names);
}
/// Feature: TestKITTIUsageTestDecodeTrue.
/// Description: test get test dataset of KITTI and test the decode.
/// Expectation: getters of KITTI get the correct value.
/// Feature: KITTIDataset
/// Description: Test KITTIDataset with test dataset and test decode
/// Expectation: Getters of KITTI get the correct value
TEST_F(MindDataTestPipeline, TestKITTIUsageTestDecodeTrue) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestKITTIGettersTestDecodeTrue.";
@ -151,9 +151,9 @@ TEST_F(MindDataTestPipeline, TestKITTIUsageTestDecodeTrue) {
EXPECT_EQ(ds->GetColumnNames(), column_names);
}
/// Feature: KITTIPipelineRandomSampler.
/// Description: test RandomSampler of KITTI.
/// Expectation: getters of KITTI get the correct value.
/// Feature: KITTIDataset
/// Description: Test KITTIDataset with RandomSampler
/// Expectation: Getters of KITTI get the correct value
TEST_F(MindDataTestPipeline, TestKITTIPipelineRandomSampler) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestKITTIPipelineRandomSampler.";
@ -170,9 +170,9 @@ TEST_F(MindDataTestPipeline, TestKITTIPipelineRandomSampler) {
EXPECT_EQ(ds->GetColumnNames(), column_names);
}
/// Feature: KITTIPipelineDistributedSampler.
/// Description: test DistributedSampler of KITTI.
/// Expectation: getters of KITTI get the correct value.
/// Feature: KITTIDataset
/// Description: Test KITTIDataset with DistributedSampler
/// Expectation: Getters of KITTI get the correct value
TEST_F(MindDataTestPipeline, TestKITTIPipelineDistributedSampler) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestKITTIPipelineDistributedSampler.";
@ -200,9 +200,9 @@ TEST_F(MindDataTestPipeline, TestKITTIPipelineDistributedSampler) {
iter->Stop();
}
/// Feature: KITTIDatasetWithNullSampler.
/// Description: test null sampler of KITTI.
/// Expectation: throw exception correctly.
/// Feature: KITTIDataset
/// Description: Test KITTIDataset with null sampler
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestKITTIWithNullSamplerError) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestKITTIWithNullSamplerError.";
// Create a KITTI Dataset.
@ -216,9 +216,9 @@ TEST_F(MindDataTestPipeline, TestKITTIWithNullSamplerError) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: KITTIDatasetWithNullPath.
/// Description: test null path of KITTI.
/// Expectation: throw exception correctly.
/// Feature: KITTIDataset
/// Description: Test KITTIDataset with empty string path
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestKITTIWithNullPath) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestKITTIWithNullPath.";
// Create a KITTI Dataset.
@ -232,9 +232,9 @@ TEST_F(MindDataTestPipeline, TestKITTIWithNullPath) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: KITTIDatasetWithWrongUsage.
/// Description: test wrong usage of KITTI.
/// Expectation: throw exception correctly.
/// Feature: KITTIDataset
/// Description: Test KITTIDataset with wrong usage
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestKITTIWithWrongUsage) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestKITTIWithWrongUsage.";
// Create a KITTI Dataset.

View File

@ -1,5 +1,5 @@
/**
* Copyright 2021 Huawei Technologies Co., Ltd
* Copyright 2021-2022 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -25,9 +25,9 @@ class MindDataTestPipeline : public UT::DatasetOpTesting {
protected:
};
/// Feature: KMnistTestDataset.
/// Description: test basic usage of KMnistTestDataset.
/// Expectation: get correct data.
/// Feature: KMnistDataset
/// Description: Test basic usage of KMnistDataset
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestKMnistTestDataset) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestKMnistTestDataset.";
@ -63,9 +63,9 @@ TEST_F(MindDataTestPipeline, TestKMnistTestDataset) {
iter->Stop();
}
/// Feature: KMnistTestDatasetWithPipeline.
/// Description: test KMnistTestDataset with pipeline.
/// Expectation: get correct data.
/// Feature: KMnistDataset
/// Description: Test KMnistDataset in pipeline mode
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestKMnistTestDatasetWithPipeline) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestKMnistTestDatasetWithPipeline.";
@ -122,9 +122,9 @@ TEST_F(MindDataTestPipeline, TestKMnistTestDatasetWithPipeline) {
iter->Stop();
}
/// Feature: TestKMnistDatasetIteratorOneColumn.
/// Description: test iterator of KMnistDataset with only the "image" column.
/// Expectation: get correct data.
/// Feature: KMnistDataset
/// Description: Test iterator of KMnistDataset with only the image column
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestKMnistDatasetIteratorOneColumn) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestKMnistIteratorOneColumn.";
// Create a KMnist Dataset
@ -164,9 +164,9 @@ TEST_F(MindDataTestPipeline, TestKMnistDatasetIteratorOneColumn) {
iter->Stop();
}
/// Feature: TestKMnistDatasetIteratorWrongColumn.
/// Description: test iterator of KMnistDataset with wrong column.
/// Expectation: get none piece of data.
/// Feature: KMnistDataset
/// Description: Test iterator of KMnistDataset with wrong column
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestKMnistDatasetIteratorWrongColumn) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestKMnistDatasetIteratorWrongColumn.";
// Create a KMnist Dataset
@ -180,9 +180,9 @@ TEST_F(MindDataTestPipeline, TestKMnistDatasetIteratorWrongColumn) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: KMnistTestDatasetSize.
/// Description: test usage of get the size of KMnistTestDataset.
/// Expectation: get correct data.
/// Feature: KMnistDataset
/// Description: Test KMnistDataset GetDatasetSize
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestGetKMnistTestDatasetSize) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestGetKMnistTestDatasetSize.";
@ -195,9 +195,9 @@ TEST_F(MindDataTestPipeline, TestGetKMnistTestDatasetSize) {
EXPECT_EQ(ds->GetDatasetSize(), 10000);
}
/// Feature: KMnistTestDatasetGetters.
/// Description: test DatasetGetters of KMnistTestDataset.
/// Expectation: get correct the value.
/// Feature: KMnistDataset
/// Description: Test KMnistDataset Getters method
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestKMnistTestDatasetGetters) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestKMnistTestDatasetGetters.";
@ -236,9 +236,9 @@ TEST_F(MindDataTestPipeline, TestKMnistTestDatasetGetters) {
EXPECT_EQ(ds->GetDatasetSize(), 10000);
}
/// Feature: KMnistIteratorWrongColumn.
/// Description: test iterator of KMnistDataset with wrong column.
/// Expectation: get none piece of data.
/// Feature: KMnistDataset
/// Description: Test KMnistDataset with wrong column
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestKMnistIteratorWrongColumn) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestKMnistIteratorOneColumn.";
// Create a KMnist Dataset
@ -252,9 +252,9 @@ TEST_F(MindDataTestPipeline, TestKMnistIteratorWrongColumn) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: KMnistDatasetFail.
/// Description: test failure of KMnistDataset.
/// Expectation: get none piece of data.
/// Feature: KMnistDataset
/// Description: Test KMnistDataset with empty string as folder path
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestKMnistDatasetFail) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestKMnistDatasetFail.";
@ -268,9 +268,9 @@ TEST_F(MindDataTestPipeline, TestKMnistDatasetFail) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: KMnistDatasetWithInvalidUsageFail.
/// Description: test KMnistDataset with invalid usage.
/// Expectation: get none piece of data.
/// Feature: KMnistDataset
/// Description: Test KMnistDataset with invalid usage
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestKMnistDatasetWithInvalidUsageFail) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestKMnistDatasetWithInvalidUsageFail.";
@ -285,9 +285,9 @@ TEST_F(MindDataTestPipeline, TestKMnistDatasetWithInvalidUsageFail) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: KMnistDatasetWithNullSamplerFail.
/// Description: test KMnistDataset with null sampler.
/// Expectation: get none piece of data.
/// Feature: KMnistDataset
/// Description: Test KMnistDataset with null sampler
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestKMnistDatasetWithNullSamplerFail) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestKMnistUDatasetWithNullSamplerFail.";

View File

@ -1,5 +1,5 @@
/**
* Copyright 2021 Huawei Technologies Co., Ltd
* Copyright 2021-2022 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -26,9 +26,9 @@ class MindDataTestPipeline : public UT::DatasetOpTesting {
protected:
};
/// Feature: LFWDataset.
/// Description: test LFWDataset.
/// Expectation: get correct lfw dataset.
/// Feature: LFWDataset
/// Description: Test LFWDataset basic usage
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestLFWDataset) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestLFWDataset.";
@ -63,9 +63,9 @@ TEST_F(MindDataTestPipeline, TestLFWDataset) {
iter->Stop();
}
/// Feature: LFWPeopleDatasetGetters.
/// Description: test usage of getters LFWPeopleDataset.
/// Expectation: get correct number of data and correct tensor shape.
/// Feature: LFWDataset
/// Description: Test LFWDataset Getters method using people dataset and RandomSampler
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestLFWPeopleDatasetGetters) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestLFWPeopleDatasetGetters.";
@ -91,9 +91,9 @@ TEST_F(MindDataTestPipeline, TestLFWPeopleDatasetGetters) {
EXPECT_EQ(ds->GetColumnNames(), column_names);
}
/// Feature: LFWPairsDatasetGetters.
/// Description: test usage of getters LFWPairsDataset.
/// Expectation: get correct number of data and correct tensor shape.
/// Feature: LFWDataset
/// Description: Test LFWDataset Getters method using pairs dataset and RandomSampler
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestLFWPairsDatasetGetters) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestLFWPairsDatasetGetters.";
@ -120,9 +120,9 @@ TEST_F(MindDataTestPipeline, TestLFWPairsDatasetGetters) {
EXPECT_EQ(ds->GetColumnNames(), column_names);
}
/// Feature: LFWDataset.
/// Description: test LFWDatasetWithPipeline.
/// Expectation: get correct lfw dataset.
/// Feature: LFWDataset
/// Description: Test LFWDataset with pipeline mode
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestLFWDatasetWithPipeline) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestLFWDatasetWithPipeline.";
@ -180,9 +180,9 @@ TEST_F(MindDataTestPipeline, TestLFWDatasetWithPipeline) {
iter->Stop();
}
/// Feature: LFWDataset.
/// Description: test LFWGetDatasetSize.
/// Expectation: get correct lfw dataset.
/// Feature: LFWDataset
/// Description: Test LFWDataset GetDatasetSize
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestLFWGetDatasetSize) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestGetLFWDatasetSize.";
@ -194,9 +194,9 @@ TEST_F(MindDataTestPipeline, TestLFWGetDatasetSize) {
EXPECT_EQ(ds->GetDatasetSize(), 4);
}
/// Feature: LFWDataset.
/// Description: test LFWDatasetPeopleGetters.
/// Expectation: get correct lfw dataset.
/// Feature: LFWDataset
/// Description: Test LFWDataset Getters method with people dataset
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestLFWDatasetPeopleGetters) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestLFWPeopleDatasetGetters.";
@ -230,9 +230,9 @@ TEST_F(MindDataTestPipeline, TestLFWDatasetPeopleGetters) {
EXPECT_EQ(ds->GetDatasetSize(), 3);
}
/// Feature: LFWDataset.
/// Description: test LFWDatasetPairsGetters.
/// Expectation: get correct lfw dataset.
/// Feature: LFWDataset
/// Description: Test LFWDataset Getters method with pairs dataset
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestLFWDatasetPairsGetters) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestLFWDatasetPairsGetters.";
@ -267,9 +267,9 @@ TEST_F(MindDataTestPipeline, TestLFWDatasetPairsGetters) {
EXPECT_EQ(ds->GetDatasetSize(), 4);
}
/// Feature: LFWDataset.
/// Description: test LFWDatasetUsage.
/// Expectation: get correct lfw dataset.
/// Feature: LFWDataset
/// Description: Test LFWDataset with all usage
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestLFWDatasetUsage) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestLFWDatasetUsage.";
@ -308,9 +308,9 @@ TEST_F(MindDataTestPipeline, TestLFWDatasetUsage) {
iter->Stop();
}
/// Feature: LFWDataset.
/// Description: test LFWDatasetTImageSet.
/// Expectation: get correct lfw dataset.
/// Feature: LFWDataset
/// Description: Test LFWDataset with deepfunneled as image_set
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestLFWDatasetImagSet) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestLFWDatasetImageSet.";
@ -350,9 +350,9 @@ TEST_F(MindDataTestPipeline, TestLFWDatasetImagSet) {
}
/// Feature: LFWDataset.
/// Description: test LFWDataset with null file dir.
/// Expectation: throw exception correctly.
/// Feature: LFWDataset
/// Description: Test LFWDataset with invalid folder path (empty string)
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestLFWDatasetWithNullFileDirFail) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestLFWDatasetFail.";
@ -367,9 +367,9 @@ TEST_F(MindDataTestPipeline, TestLFWDatasetWithNullFileDirFail) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: LFWDataset.
/// Description: test LFWDataset with null sampler.
/// Expectation: throw exception correctly.
/// Feature: LFWDataset
/// Description: Test LFWDataset with null sampler
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestLFWDatasetWithNullSamplerFail) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestLFWDatasetWithNullSamplerFail.";

View File

@ -25,8 +25,8 @@ class MindDataTestPipeline : public UT::DatasetOpTesting {
};
/// Feature: LibriTTSDataset
/// Description: test LibriTTS
/// Expectation: get correct LibriTTS dataset
/// Description: Test LibriTTSDataset basic usage
/// Expectation: Get correct LibriTTS dataset
TEST_F(MindDataTestPipeline, TestLibriTTSBasic) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestLibriTTSBasic.";
@ -60,8 +60,8 @@ TEST_F(MindDataTestPipeline, TestLibriTTSBasic) {
}
/// Feature: LibriTTSDataset
/// Description: test LibriTTS with Pipeline
/// Expectation: get correct LibriTTS dataset
/// Description: Test LibriTTSDataset with pipeline mode
/// Expectation: Get correct LibriTTS dataset
TEST_F(MindDataTestPipeline, TestLibriTTSBasicWithPipeline) {
MS_LOG(INFO) << "Doing DataSetOpBatchTest-TestLibriTTSBasicWithPipeline.";
@ -141,8 +141,8 @@ TEST_F(MindDataTestPipeline, TestLibriTTSBasicWithPipeline) {
}
/// Feature: LibriTTSDataset
/// Description: test LibriTTS with invalid directory
/// Expectation: get correct LibriTTS dataset
/// Description: Test LibriTTSDataset with invalid directory
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestLibriTTSError) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestLibriTTSError.";
@ -166,8 +166,8 @@ TEST_F(MindDataTestPipeline, TestLibriTTSError) {
}
/// Feature: LibriTTSDataset
/// Description: test LibriTTS with Getters
/// Expectation: dataset is null
/// Description: Test LibriTTSDataset with Getters
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestLibriTTSGetters) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestLibriTTSGetters.";
@ -189,8 +189,8 @@ TEST_F(MindDataTestPipeline, TestLibriTTSGetters) {
}
/// Feature: LibriTTSDataset
/// Description: test LibriTTS dataset with invalid type
/// Expectation: dataset is null
/// Description: Test LibriTTSDataset with invalid usage
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestLibriTTSWithInvalidUsageError) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestLibriTTSWithInvalidUsageError.";
@ -214,8 +214,8 @@ TEST_F(MindDataTestPipeline, TestLibriTTSWithInvalidUsageError) {
}
/// Feature: LibriTTSDataset
/// Description: test LibriTTS dataset with null sampler
/// Expectation: dataset is null
/// Description: Test LibriTTSDataset with null sampler
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestLibriTTSWithNullSamplerError) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestLibriTTSWithNullSamplerError.";
@ -231,8 +231,8 @@ TEST_F(MindDataTestPipeline, TestLibriTTSWithNullSamplerError) {
}
/// Feature: LibriTTSDataset
/// Description: test LibriTTS with sequential sampler
/// Expectation: get correct LibriTTS dataset
/// Description: Test LibriTTSDataset with SequentialSampler
/// Expectation: Get correct LibriTTS dataset
TEST_F(MindDataTestPipeline, TestLibriTTSSequentialSamplers) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestLibriTTSSequentialSamplers.";

View File

@ -1,5 +1,5 @@
/**
* Copyright 2021 Huawei Technologies Co., Ltd
* Copyright 2021-2022 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -27,8 +27,8 @@ class MindDataTestPipeline : public UT::DatasetOpTesting {
};
/// Feature: LJSpeechDataset
/// Description: basic test of LJSpeechDataset
/// Expectation: the data is processed successfully
/// Description: Basic test of LJSpeechDataset
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestLJSpeechDataset) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestLJSpeechDataset.";
std::string folder_path = datasets_root_path_ + "/testLJSpeechData/";
@ -64,8 +64,8 @@ TEST_F(MindDataTestPipeline, TestLJSpeechDataset) {
}
/// Feature: LJSpeechDataset
/// Description: test LJSpeechDataset in pipeline mode
/// Expectation: the data is processed successfully
/// Description: Test LJSpeechDataset in pipeline mode
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestLJSpeechDatasetWithPipeline) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestLJSpeechDatasetWithPipeline.";
@ -123,9 +123,9 @@ TEST_F(MindDataTestPipeline, TestLJSpeechDatasetWithPipeline) {
iter->Stop();
}
/// Feature: TestLJSpeechDatasetIteratorOneColumn.
/// Description: test iterator of LJSpeechDataset with only the "waveform" column.
/// Expectation: get correct data.
/// Feature: LJSpeechDataset
/// Description: Test iterator of LJSpeechDataset with only the waveform column
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestLJSpeechDatasetIteratorOneColumn) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestLJSpeechDatasetIteratorOneColumn.";
// Create a LJSpeech dataset
@ -163,9 +163,9 @@ TEST_F(MindDataTestPipeline, TestLJSpeechDatasetIteratorOneColumn) {
iter->Stop();
}
/// Feature: TestLJSpeechDatasetIteratorWrongColumn.
/// Description: test iterator of LJSpeechDataset with wrong column.
/// Expectation: get none piece of data.
/// Feature: LJSpeechDataset
/// Description: Test iterator of LJSpeechDataset with wrong column
/// Expectation: Error message is logged, and CreateIterator for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestLJSpeechDatasetIteratorWrongColumn) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestLJSpeechDatasetIteratorWrongColumn.";
// Create a LJSpeech Dataset
@ -180,8 +180,8 @@ TEST_F(MindDataTestPipeline, TestLJSpeechDatasetIteratorWrongColumn) {
}
/// Feature: LJSpeechDataset
/// Description: test getting size of LJSpeechDataset
/// Expectation: the size is correct
/// Description: Test getting size of LJSpeechDataset
/// Expectation: The size is correct
TEST_F(MindDataTestPipeline, TestLJSpeechGetDatasetSize) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestLJSpeechGetDatasetSize.";
@ -194,8 +194,8 @@ TEST_F(MindDataTestPipeline, TestLJSpeechGetDatasetSize) {
}
/// Feature: LJSpeechDataset
/// Description: test LJSpeechDataset with mix getter
/// Expectation: the data is processed successfully
/// Description: Test LJSpeechDataset Getters method
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestLJSpeechGetters) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestLJSpeechMixGetter.";
@ -228,8 +228,8 @@ TEST_F(MindDataTestPipeline, TestLJSpeechGetters) {
}
/// Feature: LJSpeechDataset
/// Description: test LJSpeechDataset with the fail of reading dataset
/// Expectation: throw correct error and message
/// Description: Test LJSpeechDataset with the fail of reading dataset
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestLJSpeechDatasetFail) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestLJSpeechDatasetFail.";
@ -244,8 +244,8 @@ TEST_F(MindDataTestPipeline, TestLJSpeechDatasetFail) {
}
/// Feature: LJSpeechDataset
/// Description: test LJSpeechDataset with the null sampler
/// Expectation: throw correct error and message
/// Description: Test LJSpeechDataset with the null sampler
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestLJSpeechDatasetWithNullSamplerFail) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestLJSpeechDatasetWithNullSamplerFail.";

View File

@ -1,5 +1,5 @@
/**
* Copyright 2021 Huawei Technologies Co., Ltd
* Copyright 2021-2022 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -26,9 +26,9 @@ class MindDataTestPipeline : public UT::DatasetOpTesting {
protected:
};
/// Feature: LSUNDataset.
/// Description: test LSUNDataset.
/// Expectation: get correct lsun dataset.
/// Feature: LSUNDataset
/// Description: Test LSUNDataset with train dataset
/// Expectation: Get correct LSUNDataset
TEST_F(MindDataTestPipeline, TestLSUNTrainDataset) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestLSUNTrainDataset.";
@ -63,9 +63,9 @@ TEST_F(MindDataTestPipeline, TestLSUNTrainDataset) {
iter->Stop();
}
/// Feature: LSUNDataset.
/// Description: test LSUNDataset.
/// Expectation: get correct lsun dataset.
/// Feature: LSUNDataset
/// Description: Test LSUNDataset with valid dataset
/// Expectation: Get correct LSUNDataset
TEST_F(MindDataTestPipeline, TestLSUNValidDataset) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestLSUNValidDataset.";
@ -100,9 +100,9 @@ TEST_F(MindDataTestPipeline, TestLSUNValidDataset) {
iter->Stop();
}
/// Feature: LSUNDataset.
/// Description: test LSUNDataset.
/// Expectation: get correct lsun dataset.
/// Feature: LSUNDataset
/// Description: Test LSUNDataset with test dataset
/// Expectation: Get correct LSUNDataset
TEST_F(MindDataTestPipeline, TestLSUNTestDataset) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestLSUNTestDataset.";
@ -137,9 +137,9 @@ TEST_F(MindDataTestPipeline, TestLSUNTestDataset) {
iter->Stop();
}
/// Feature: LSUNDataset.
/// Description: test LSUNDataset.
/// Expectation: get correct lsun dataset.
/// Feature: LSUNDataset
/// Description: Test LSUNDataset with all dataset
/// Expectation: Get correct LSUNDataset
TEST_F(MindDataTestPipeline, TestLSUNAllDataset) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestLSUNAllDataset.";
@ -174,9 +174,9 @@ TEST_F(MindDataTestPipeline, TestLSUNAllDataset) {
iter->Stop();
}
/// Feature: LSUNDataset.
/// Description: test LSUNDataset.
/// Expectation: get correct lsun dataset.
/// Feature: LSUNDataset
/// Description: Test LSUNDataset with classes
/// Expectation: Get correct LSUNDataset
TEST_F(MindDataTestPipeline, TestLSUNClassesDataset) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestLSUNClassesDataset.";
@ -212,9 +212,9 @@ TEST_F(MindDataTestPipeline, TestLSUNClassesDataset) {
iter->Stop();
}
/// Feature: LSUNDataset.
/// Description: test LSUNDataset.
/// Expectation: get correct lsun dataset.
/// Feature: LSUNDataset
/// Description: Test LSUNDataset in pipeline mode
/// Expectation: Get correct LSUNDataset
TEST_F(MindDataTestPipeline, TestLSUNDatasetWithPipeline) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestLSUNDatasetWithPipeline.";
@ -272,9 +272,9 @@ TEST_F(MindDataTestPipeline, TestLSUNDatasetWithPipeline) {
iter->Stop();
}
/// Feature: LSUNDataset.
/// Description: test LSUNDataset.
/// Expectation: get correct lsun dataset.
/// Feature: LSUNDataset
/// Description: Test LSUNDataset GetDatasetSize
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestLSUNGetDatasetSize) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestLSUNGetDatasetSize.";
@ -287,8 +287,8 @@ TEST_F(MindDataTestPipeline, TestLSUNGetDatasetSize) {
}
/// Feature: LSUNDataset.
/// Description: test LSUNDataset.
/// Expectation: get correct lsun dataset.
/// Description: Test LSUNDataset.
/// Expectation: Get correct lsun dataset.
TEST_F(MindDataTestPipeline, TestLSUNClassesGetDatasetSize) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestGetLSUNClassesDatasetSize.";
@ -300,9 +300,9 @@ TEST_F(MindDataTestPipeline, TestLSUNClassesGetDatasetSize) {
EXPECT_EQ(ds->GetDatasetSize(), 2);
}
/// Feature: LSUNDataset.
/// Description: test LSUNDataset.
/// Expectation: get correct lsun dataset.
/// Feature: LSUNDataset
/// Description: Test LSUNDataset Getters method
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestLSUNDatasetGetters) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestLSUNDatasetGetters.";
@ -332,9 +332,9 @@ TEST_F(MindDataTestPipeline, TestLSUNDatasetGetters) {
EXPECT_EQ(ds->GetColumnNames(), column_names);
}
/// Feature: LSUNDataset.
/// Description: test LSUNDataset with wrong folder path.
/// Expectation: throw exception correctly.
/// Feature: LSUNDataset
/// Description: Test LSUNDataset with wrong folder path
/// Expectation: Throw exception correctly
TEST_F(MindDataTestPipeline, TestLSUNDatasetFail) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestLSUNDatasetFail.";
@ -348,9 +348,9 @@ TEST_F(MindDataTestPipeline, TestLSUNDatasetFail) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: LSUNDataset.
/// Description: test LSUNDataset with null sampler.
/// Expectation: throw exception correctly.
/// Feature: LSUNDataset
/// Description: Test LSUNDataset with null sampler
/// Expectation: Throw exception correctly
TEST_F(MindDataTestPipeline, TestLSUNDatasetWithNullSamplerFail) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestLSUNDatasetWithNullSamplerFail.";

View File

@ -1,5 +1,5 @@
/**
* Copyright 2020-2021 Huawei Technologies Co., Ltd
* Copyright 2020-2022 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -23,9 +23,9 @@ class MindDataTestPipeline : public UT::DatasetOpTesting {
protected:
};
/// Feature: ManifestBasic.
/// Description: test basic usage of ManifestDataset.
/// Expectation: get correct number of data.
/// Feature: ManifestDataset
/// Description: Test basic usage of ManifestDataset
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestManifestBasic) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestManifestBasic.";
@ -57,9 +57,9 @@ TEST_F(MindDataTestPipeline, TestManifestBasic) {
iter->Stop();
}
/// Feature: ManifestBasicWithPipeline.
/// Description: test usage of ManifestDataset with pipeline.
/// Expectation: get correct number of data.
/// Feature: ManifestDataset
/// Description: Test ManifestDataset in pipeline mode
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestManifestBasicWithPipeline) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestManifestBasicWithPipeline.";
@ -112,9 +112,9 @@ TEST_F(MindDataTestPipeline, TestManifestBasicWithPipeline) {
iter->Stop();
}
/// Feature: ManifestIteratorOneColumn.
/// Description: test iterator of ManifestDataset with only the "image" column.
/// Expectation: get correct data.
/// Feature: ManifestDataset
/// Description: Test iterator of ManifestDataset with only the image column
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestManifestIteratorOneColumn) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestManifestIteratorOneColumn.";
std::string file_path = datasets_root_path_ + "/testManifestData/cpp.json";
@ -152,9 +152,9 @@ TEST_F(MindDataTestPipeline, TestManifestIteratorOneColumn) {
iter->Stop();
}
/// Feature: ManifestIteratorWrongColumn.
/// Description: test iterator of ManifestDataset with wrong column.
/// Expectation: get none piece of data.
/// Feature: ManifestDataset
/// Description: Test iterator of ManifestDataset with wrong column
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestManifestIteratorWrongColumn) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestManifestIteratorWrongColumn.";
std::string file_path = datasets_root_path_ + "/testManifestData/cpp.json";
@ -168,9 +168,9 @@ TEST_F(MindDataTestPipeline, TestManifestIteratorWrongColumn) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: ManifestGetters.
/// Description: test usage of getters ManifestDataset.
/// Expectation: get correct number of data and correct tensor shape.
/// Feature: ManifestDataset
/// Description: Test ManifestDataset Getters method
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestManifestGetters) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestManifestGetters.";
@ -207,9 +207,9 @@ TEST_F(MindDataTestPipeline, TestManifestGetters) {
EXPECT_EQ(class_index2[2].second[0], 2);
}
/// Feature: ManifestDecode.
/// Description: test usage of ManifestDecode.
/// Expectation: get correct number of data.
/// Feature: ManifestDataset
/// Description: Test ManifestDataset with Decode
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestManifestDecode) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestManifestDecode.";
@ -244,9 +244,9 @@ TEST_F(MindDataTestPipeline, TestManifestDecode) {
iter->Stop();
}
/// Feature: ManifestEval.
/// Description: test usage of ManifestEval.
/// Expectation: get correct number of data.
/// Feature: ManifestDataset
/// Description: Test ManifestDataset with eval usage
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestManifestEval) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestManifestEval.";
@ -278,9 +278,9 @@ TEST_F(MindDataTestPipeline, TestManifestEval) {
iter->Stop();
}
/// Feature: ManifestClassIndex.
/// Description: test usage of ManifestClassIndex.
/// Expectation: get correct number of data.
/// Feature: ManifestDataset
/// Description: Test ManifestDataset with class index
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestManifestClassIndex) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestManifestClassIndex.";
@ -335,9 +335,9 @@ TEST_F(MindDataTestPipeline, TestManifestClassIndex) {
iter->Stop();
}
/// Feature: ManifestNumSamplers.
/// Description: test usage of ManifestDataset with num sampler.
/// Expectation: get correct piece of data.
/// Feature: ManifestDataset
/// Description: Test ManifestDataset with num sampler
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestManifestNumSamplers) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestManifestNumSamplers.";
@ -369,9 +369,9 @@ TEST_F(MindDataTestPipeline, TestManifestNumSamplers) {
iter->Stop();
}
/// Feature: ManifestError.
/// Description: test failure of Manifest Dataset.
/// Expectation: get none piece of data.
/// Feature: ManifestDataset
/// Description: Test ManifestDataset with invalid inputs
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestManifestError) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestManifestError.";
@ -404,9 +404,9 @@ TEST_F(MindDataTestPipeline, TestManifestError) {
EXPECT_EQ(iter2, nullptr);
}
/// Feature: ManifestWithNullSamplerError.
/// Description: test failure of ManifestDataset with null sampler.
/// Expectation: get none piece of data.
/// Feature: ManifestDataset
/// Description: Test ManifestDataset with null sampler
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestManifestWithNullSamplerError) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestManifestWithNullSamplerError.";
std::string file_path = datasets_root_path_ + "/testManifestData/cpp.json";
@ -420,9 +420,9 @@ TEST_F(MindDataTestPipeline, TestManifestWithNullSamplerError) {
EXPECT_EQ(iter, nullptr);
}
// Feature: Test SubsetRandomSampler with Manifest
// Description: Use SubsetRandomSampler with 1 index given, iterate through dataset and count rows
// Expectation: There should be 1 row in the dataset
/// Feature: ManifestDataset
/// Description: Test with SubsetRandomSampler with 1 index given, iterate through dataset and count rows
/// Expectation: There should be 1 row in the dataset
TEST_F(MindDataTestPipeline, TestManifestSubsetRandomSampler) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestManifestSubsetRandomSampler.";

View File

@ -1,5 +1,5 @@
/**
* Copyright 2020-2021 Huawei Technologies Co., Ltd
* Copyright 2020-2022 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -24,6 +24,9 @@ class MindDataTestPipeline : public UT::DatasetOpTesting {
protected:
};
/// Feature: MindDataDataset
/// Description: Test MindDataDataset with string file pattern
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestMindDataSuccess1) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestMindDataSuccess1 with string file pattern.";
@ -59,6 +62,9 @@ TEST_F(MindDataTestPipeline, TestMindDataSuccess1) {
iter->Stop();
}
/// Feature: MindDataDataset
/// Description: Test MindDataDataset Getters method
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestMindDataGetters) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestMindDataGetters with string file pattern.";
@ -75,6 +81,9 @@ TEST_F(MindDataTestPipeline, TestMindDataGetters) {
EXPECT_EQ(ds->GetColumnNames(), column_names);
}
/// Feature: MindDataDataset
/// Description: Test MindDataDataset with a vector of single MindRecord file
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestMindDataSuccess2) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestMindDataSuccess2 with a vector of single mindrecord file.";
@ -109,6 +118,9 @@ TEST_F(MindDataTestPipeline, TestMindDataSuccess2) {
iter->Stop();
}
/// Feature: MindDataDataset
/// Description: Test MindDataDataset with a vector of multiple MindRecord files
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestMindDataSuccess3) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestMindDataSuccess3 with a vector of multiple mindrecord files.";
@ -145,6 +157,9 @@ TEST_F(MindDataTestPipeline, TestMindDataSuccess3) {
iter->Stop();
}
/// Feature: MindDataDataset
/// Description: Test MindDataDataset with specified column
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestMindDataSuccess4) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestMindDataSuccess4 with specified column.";
@ -180,6 +195,9 @@ TEST_F(MindDataTestPipeline, TestMindDataSuccess4) {
iter->Stop();
}
/// Feature: MindDataDataset
/// Description: Test MindDataDataset with specified sampler
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestMindDataSuccess5) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestMindDataSuccess5 with specified sampler.";
@ -220,6 +238,9 @@ TEST_F(MindDataTestPipeline, TestMindDataSuccess5) {
iter->Stop();
}
/// Feature: MindDataDataset
/// Description: Test MindDataDataset with num_samples out of range
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestMindDataSuccess6) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestMindDataSuccess6 with num_samples out of range.";
@ -279,6 +300,9 @@ TEST_F(MindDataTestPipeline, TestMindDataSuccess6) {
}
}
/// Feature: MindDataDataset
/// Description: Test MindDataDataset with padded sample with skip op
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestMindDataSuccess7) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestMindDataSuccess7 with padded sample.";
@ -331,6 +355,9 @@ TEST_F(MindDataTestPipeline, TestMindDataSuccess7) {
iter->Stop();
}
/// Feature: MindDataDataset
/// Description: Test MindDataDataset with padded sample with skip op and repeat op
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestMindDataSuccess8) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestMindDataSuccess8 with padded sample.";
@ -402,6 +429,9 @@ TEST_F(MindDataTestPipeline, TestMindDataSuccess8) {
iter->Stop();
}
/// Feature: MindDataDataset
/// Description: Test MindDataDataset with padded sample with repeat op, project op, and concat op
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestMindDataSuccess9) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestMindDataSuccess9 with padded sample.";
@ -475,6 +505,9 @@ TEST_F(MindDataTestPipeline, TestMindDataSuccess9) {
iter->Stop();
}
/// Feature: MindDataDataset
/// Description: Test MindDataDataset with incorrect file path
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestMindDataFail1) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestMindDataFail1 with incorrect file path.";
@ -511,6 +544,9 @@ TEST_F(MindDataTestPipeline, TestMindDataFail1) {
EXPECT_EQ(iter3, nullptr);
}
/// Feature: MindDataDataset
/// Description: Test MindDataDataset with incorrect column name
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestMindDataFail2) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestMindDataFail2 with incorrect column name.";
@ -547,6 +583,9 @@ TEST_F(MindDataTestPipeline, TestMindDataFail2) {
EXPECT_EQ(iter3, nullptr);
}
/// Feature: MindDataDataset
/// Description: Test MindDataDataset with unsupported sampler
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestMindDataFail3) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestMindDataFail3 with unsupported sampler.";
@ -571,6 +610,9 @@ TEST_F(MindDataTestPipeline, TestMindDataFail3) {
EXPECT_EQ(iter2, nullptr);
}
/// Feature: MindDataDataset
/// Description: Test MindDataDataset with invalid num_padded and padded_sample set of inputs
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestMindDataFail4) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestMindData with padded sample.";

View File

@ -25,8 +25,8 @@ class MindDataTestPipeline : public UT::DatasetOpTesting {
};
/// Feature: Test Multi30k Dataset(English).
/// Description: read Multi30kDataset data and get data.
/// Expectation: the data is processed successfully.
/// Description: Read Multi30kDataset data and get data.
/// Expectation: The data is processed successfully.
TEST_F(MindDataTestPipeline, TestMulti30kSuccessEn) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestMulti30kSuccessEn.";
// Test Multi30k English files with default parameters
@ -134,8 +134,8 @@ TEST_F(MindDataTestPipeline, TestMulti30kSuccessEn) {
}
/// Feature: Test Multi30k Dataset(Germany).
/// Description: read Multi30kDataset data and get data.
/// Expectation: the data is processed successfully.
/// Description: Read Multi30kDataset data and get data.
/// Expectation: The data is processed successfully.
TEST_F(MindDataTestPipeline, TestMulti30kSuccessDe) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestMulti30kSuccessDe.";
// Test Multi30k Germany files with default parameters
@ -243,8 +243,8 @@ TEST_F(MindDataTestPipeline, TestMulti30kSuccessDe) {
}
/// Feature: Test Multi30k Dataset(Germany).
/// Description: read Multi30kDataset data and get data.
/// Expectation: the data is processed successfully.
/// Description: Read Multi30kDataset data and get data.
/// Expectation: The data is processed successfully.
TEST_F(MindDataTestPipeline, TestMulti30kDatasetBasicWithPipeline) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestMulti30kDatasetBasicWithPipeline.";
@ -301,8 +301,8 @@ TEST_F(MindDataTestPipeline, TestMulti30kDatasetBasicWithPipeline) {
}
/// Feature: Test Getters.
/// Description: includes tests for shape, type, size.
/// Expectation: the data is processed successfully.
/// Description: Includes tests for shape, type, size.
/// Expectation: The data is processed successfully.
TEST_F(MindDataTestPipeline, TestMulti30kGetters) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestMulti30kGetters.";
@ -317,8 +317,8 @@ TEST_F(MindDataTestPipeline, TestMulti30kGetters) {
}
/// Feature: Test Multi30kDataset in distribution.
/// Description: test interface in a distributed state.
/// Expectation: the data is processed successfully.
/// Description: Test interface in a distributed state.
/// Expectation: The data is processed successfully.
TEST_F(MindDataTestPipeline, TestMulti30kDatasetDistribution) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestMulti30kDatasetDistribution.";
@ -354,8 +354,8 @@ TEST_F(MindDataTestPipeline, TestMulti30kDatasetDistribution) {
}
/// Feature: Error Test.
/// Description: test the wrong input.
/// Expectation: unable to read in data.
/// Description: Test the wrong input.
/// Expectation: Unable to read in data.
TEST_F(MindDataTestPipeline, TestMulti30kDatasetFailInvalidFilePath) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestMulti30kDatasetFailInvalidFilePath.";
@ -368,8 +368,8 @@ TEST_F(MindDataTestPipeline, TestMulti30kDatasetFailInvalidFilePath) {
}
/// Feature: Error Test.
/// Description: test the wrong input.
/// Expectation: unable to read in data.
/// Description: Test the wrong input.
/// Expectation: Unable to read in data.
TEST_F(MindDataTestPipeline, TestMulti30kDatasetFailInvalidUsage) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestMulti30kDatasetFailInvaildUsage.";
@ -382,8 +382,8 @@ TEST_F(MindDataTestPipeline, TestMulti30kDatasetFailInvalidUsage) {
}
/// Feature: Error Test.
/// Description: test the wrong input.
/// Expectation: unable to read in data.
/// Description: Test the wrong input.
/// Expectation: Unable to read in data.
TEST_F(MindDataTestPipeline, TestMulti30kDatasetFailInvalidLanguagePair) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestMulti30kDatasetFailLanguagePair.";
@ -400,8 +400,8 @@ TEST_F(MindDataTestPipeline, TestMulti30kDatasetFailInvalidLanguagePair) {
}
/// Feature: Error Test.
/// Description: test the wrong input.
/// Expectation: unable to read in data.
/// Description: Test the wrong input.
/// Expectation: Unable to read in data.
TEST_F(MindDataTestPipeline, TestMulti30kDatasetFailInvalidNumSamples) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestMulti30kDatasetFailInvalidNumSamples.";
@ -419,8 +419,8 @@ TEST_F(MindDataTestPipeline, TestMulti30kDatasetFailInvalidNumSamples) {
}
/// Feature: Error Test.
/// Description: test the wrong input.
/// Expectation: unable to read in data.
/// Description: Test the wrong input.
/// Expectation: Unable to read in data.
TEST_F(MindDataTestPipeline, TestMulti30kDatasetFailInvalidShards) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestMulti30kDatasetFailInvalidShards.";
@ -438,8 +438,8 @@ TEST_F(MindDataTestPipeline, TestMulti30kDatasetFailInvalidShards) {
}
/// Feature: Error Test.
/// Description: test the wrong input.
/// Expectation: unable to read in data.
/// Description: Test the wrong input.
/// Expectation: Unable to read in data.
TEST_F(MindDataTestPipeline, TestMulti30kDatasetFailInvalidShardID) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestMulti30kDatasetFailInvalidShardID.";
@ -457,8 +457,8 @@ TEST_F(MindDataTestPipeline, TestMulti30kDatasetFailInvalidShardID) {
}
/// Feature: Error Test.
/// Description: test the wrong input.
/// Expectation: unable to read in data.
/// Description: Test the wrong input.
/// Expectation: Unable to read in data.
TEST_F(MindDataTestPipeline, TestMulti30kDatasetLanguagePair) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestMulti30kDatasetLanguagePair.";
@ -497,8 +497,8 @@ TEST_F(MindDataTestPipeline, TestMulti30kDatasetLanguagePair) {
}
/// Feature: Test Multi30k Dataset(shufflemode=kFalse).
/// Description: test Multi30k Dataset interface with different ShuffleMode.
/// Expectation: the data is processed successfully.
/// Description: Test Multi30k Dataset interface with different ShuffleMode.
/// Expectation: The data is processed successfully.
TEST_F(MindDataTestPipeline, TestMulti30kDatasetShuffleFilesFalse) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestMulti30kDatasetShuffleFilesFalse.";
@ -554,8 +554,8 @@ TEST_F(MindDataTestPipeline, TestMulti30kDatasetShuffleFilesFalse) {
}
/// Feature: Test Multi30k Dataset(shufflemode=kFiles).
/// Description: test Multi30k Dataset interface with different ShuffleMode.
/// Expectation: the data is processed successfully.
/// Description: Test Multi30k Dataset interface with different ShuffleMode.
/// Expectation: The data is processed successfully.
TEST_F(MindDataTestPipeline, TestMulti30kDatasetShuffleFilesFiles) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestMulti30kDatasetShuffleFilesFiles.";
@ -611,8 +611,8 @@ TEST_F(MindDataTestPipeline, TestMulti30kDatasetShuffleFilesFiles) {
}
/// Feature: Test Multi30k Dataset(shufflemode=kGlobal).
/// Description: test Multi30k Dataset interface with different ShuffleMode.
/// Expectation: the data is processed successfully.
/// Description: Test Multi30k Dataset interface with different ShuffleMode.
/// Expectation: The data is processed successfully.
TEST_F(MindDataTestPipeline, TestMulti30kDatasetShuffleFilesGlobal) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestMulti30kDatasetShuffleFilesGlobal.";

View File

@ -1,5 +1,5 @@
/**
* Copyright 2021 Huawei Technologies Co., Ltd
* Copyright 2021-2022 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -27,8 +27,8 @@ class MindDataTestPipeline : public UT::DatasetOpTesting {
};
/// Feature: OmniglotDataset
/// Description: test Omniglot
/// Expectation: get correct Omniglot dataset
/// Description: Test OmniglotDataset using background dataset
/// Expectation: Get correct Omniglot dataset
TEST_F(MindDataTestPipeline, TestOmniglotBackgroundDataset) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestOmniglotBackgroundDataset.";
@ -64,8 +64,8 @@ TEST_F(MindDataTestPipeline, TestOmniglotBackgroundDataset) {
}
/// Feature: OmniglotDataset
/// Description: test Omniglot
/// Expectation: get correct Omniglot dataset
/// Description: Test OmniglotDataset using evaluation dataset
/// Expectation: Get correct Omniglot dataset
TEST_F(MindDataTestPipeline, TestOmniglotEvaluationDataset) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestOmniglotEvaluationDataset.";
@ -101,8 +101,8 @@ TEST_F(MindDataTestPipeline, TestOmniglotEvaluationDataset) {
}
/// Feature: OmniglotDataset
/// Description: test Omniglot
/// Expectation: get correct Omniglot dataset
/// Description: Test OmniglotDataset using background dataset with pipeline mode
/// Expectation: Get correct Omniglot dataset
TEST_F(MindDataTestPipeline, TestOmniglotBackgroundDatasetWithPipeline) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestOmniglotBackgroundDatasetWithPipeline.";
@ -159,8 +159,8 @@ TEST_F(MindDataTestPipeline, TestOmniglotBackgroundDatasetWithPipeline) {
}
/// Feature: OmniglotDataset
/// Description: test Omniglot
/// Expectation: get correct Omniglot dataset
/// Description: Test OmniglotDataset GetDatasetSize with background dataset
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestOmniglotBackgroundGetDatasetSize) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestGetOmniglotBackgroundSize.";
@ -173,8 +173,8 @@ TEST_F(MindDataTestPipeline, TestOmniglotBackgroundGetDatasetSize) {
}
/// Feature: OmniglotDataset
/// Description: test Omniglot
/// Expectation: get correct Omniglot dataset
/// Description: Test OmniglotDataset GetDatasetSize with evaluation dataset
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestOmniglotEvaluationGetDatasetSize) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestGetOmniglotEvaluationDatasetSize.";
@ -187,8 +187,8 @@ TEST_F(MindDataTestPipeline, TestOmniglotEvaluationGetDatasetSize) {
}
/// Feature: OmniglotDataset
/// Description: test Omniglot
/// Expectation: get correct Omniglot dataset
/// Description: Test OmniglotDataset Getters method with background dataset
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestOmniglotBackgroundDatasetGetters) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestOmniglotBackgroundDatasetGetters.";
@ -227,8 +227,8 @@ TEST_F(MindDataTestPipeline, TestOmniglotBackgroundDatasetGetters) {
}
/// Feature: OmniglotDataset
/// Description: test Omniglot
/// Expectation: get correct Omniglot dataset
/// Description: Test OmniglotDataset Getters method with evaluation dataset
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestOmniglotEvaluationDatasetGetters) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestOmniglotTestDatasetGetters.";
@ -263,9 +263,9 @@ TEST_F(MindDataTestPipeline, TestOmniglotEvaluationDatasetGetters) {
EXPECT_EQ(ds->GetNumClasses(), 2);
}
/// Feature: TestOmniglotDatasetFail
/// Description: test invalid num_images of Omniglot
/// Expectation: throw exception correctly
/// Feature: OmniglotDataset
/// Description: Test OmniglotDataset with invalid num_images
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestOmniglotDatasetFail) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestOmniglotDatasetFail.";
@ -279,9 +279,9 @@ TEST_F(MindDataTestPipeline, TestOmniglotDatasetFail) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: TestOmniglotDatasetWithNullSampler
/// Description: test null sampler of Omniglot
/// Expectation: throw exception correctly
/// Feature: OmniglotDataset
/// Description: Test OmniglotDataset with null sampler
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestOmniglotDatasetWithNullSamplerFail) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestOmniglotDatasetWithNullSamplerFail.";

View File

@ -1,5 +1,5 @@
/**
* Copyright 2020-2021 Huawei Technologies Co., Ltd
* Copyright 2020-2022 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -153,6 +153,9 @@ MSTensorVec BucketBatchTestFunction(MSTensorVec input) {
return RowToVec(output);
}
/// Feature: Batch and Repeat ops
/// Description: Test Batch and Repeat ops on MnistDataset
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestBatchAndRepeat) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestBatchAndRepeat.";
@ -194,6 +197,9 @@ TEST_F(MindDataTestPipeline, TestBatchAndRepeat) {
iter->Stop();
}
/// Feature: BucketBatchByLength op
/// Description: Test BucketBatchByLength op with default values
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestBucketBatchByLengthSuccess1) {
// Calling with default values
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestBucketBatchByLengthSuccess1.";
@ -230,6 +236,9 @@ TEST_F(MindDataTestPipeline, TestBucketBatchByLengthSuccess1) {
iter->Stop();
}
/// Feature: BucketBatchByLength op
/// Description: Test BucketBatchByLength op with non-default values
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestBucketBatchByLengthSuccess2) {
// Calling with non-default values
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestBucketBatchByLengthSuccess2.";
@ -267,6 +276,9 @@ TEST_F(MindDataTestPipeline, TestBucketBatchByLengthSuccess2) {
iter->Stop();
}
/// Feature: BucketBatchByLength op
/// Description: Test BucketBatchByLength op with empty bucket_boundaries
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestBucketBatchByLengthFail1) {
// Empty bucket_boundaries
// Calling with function pointer
@ -287,6 +299,9 @@ TEST_F(MindDataTestPipeline, TestBucketBatchByLengthFail1) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: BucketBatchByLength op
/// Description: Test BucketBatchByLength op with empty bucket_batch_sizes
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestBucketBatchByLengthFail2) {
// Empty bucket_batch_sizes
// Calling with function pointer
@ -307,6 +322,9 @@ TEST_F(MindDataTestPipeline, TestBucketBatchByLengthFail2) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: BucketBatchByLength op
/// Description: Test BucketBatchByLength op with negative boundaries
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestBucketBatchByLengthFail3) {
// Negative boundaries
// Calling with function pointer
@ -327,6 +345,9 @@ TEST_F(MindDataTestPipeline, TestBucketBatchByLengthFail3) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: BucketBatchByLength op
/// Description: Test BucketBatchByLength op with boundaries not strictly increasing
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestBucketBatchByLengthFail4) {
// Boundaries not strictly increasing
// Calling with function pointer
@ -347,6 +368,9 @@ TEST_F(MindDataTestPipeline, TestBucketBatchByLengthFail4) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: BucketBatchByLength op
/// Description: Test BucketBatchByLength op with incorrect size of bucket_batch_size
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestBucketBatchByLengthFail5) {
// Incorrect size of bucket_batch_size
// Calling with function pointer
@ -367,6 +391,9 @@ TEST_F(MindDataTestPipeline, TestBucketBatchByLengthFail5) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: BucketBatchByLength op
/// Description: Test BucketBatchByLength op with negative bucket_batch_size
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestBucketBatchByLengthFail6) {
// Negative bucket_batch_size
// Calling with function pointer
@ -386,6 +413,9 @@ TEST_F(MindDataTestPipeline, TestBucketBatchByLengthFail6) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: BucketBatchByLength op
/// Description: Test with element_length_function not specified and column_names has more than 1 element
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestBucketBatchByLengthFail7) {
// This should fail because element_length_function is not specified and column_names has more than 1 element.
// Calling with function pointer
@ -406,6 +436,9 @@ TEST_F(MindDataTestPipeline, TestBucketBatchByLengthFail7) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: Concat op
/// Description: Test Concat op where the input column names of concatenated datasets are not the same
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestConcatFail1) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestConcatFail1.";
// This case is expected to fail because the input column names of concatenated datasets are not the same
@ -438,6 +471,9 @@ TEST_F(MindDataTestPipeline, TestConcatFail1) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: Concat op
/// Description: Test Concat op where the input dataset is empty
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestConcatFail2) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestConcatFail2.";
// This case is expected to fail because the input dataset is empty.
@ -458,6 +494,9 @@ TEST_F(MindDataTestPipeline, TestConcatFail2) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: Concat op
/// Description: Test Concat op where the input dataset is nullptr
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestConcatFail3) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestConcatFail3.";
// This case is expected to fail because the input dataset is nullptr.
@ -478,6 +517,9 @@ TEST_F(MindDataTestPipeline, TestConcatFail3) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: Concat op
/// Description: Test Concat op where the input dataset is nullptr
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestConcatFail4) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestConcatFail4.";
// This case is expected to fail because the input dataset is nullptr.
@ -498,6 +540,9 @@ TEST_F(MindDataTestPipeline, TestConcatFail4) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: Concat op
/// Description: Test Concat op where the dataset concat itself which causes ProjectNode with two parent nodes
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestConcatFail5) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestConcatFail5.";
// This case is expected to fail because the dataset concat itself which causes ProjectNode has two parent nodes
@ -527,6 +572,9 @@ TEST_F(MindDataTestPipeline, TestConcatFail5) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: Concat op
/// Description: Test Concat op basic usage
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestConcatSuccess) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestConcatSuccess.";
@ -578,6 +626,9 @@ TEST_F(MindDataTestPipeline, TestConcatSuccess) {
iter->Stop();
}
/// Feature: Concat op
/// Description: Test Concat op followed by GetDatasetSize
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestConcatGetDatasetSize) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestConcatGetDatasetSize.";
@ -606,6 +657,9 @@ TEST_F(MindDataTestPipeline, TestConcatGetDatasetSize) {
EXPECT_EQ(ds->GetDatasetSize(), 19);
}
/// Feature: Concat op
/// Description: Test Concat op using "+" operator to concat two datasets
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestConcatSuccess2) {
// Test "+" operator to concat two datasets
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestConcatSuccess2.";
@ -658,6 +712,9 @@ TEST_F(MindDataTestPipeline, TestConcatSuccess2) {
iter->Stop();
}
/// Feature: Filter op
/// Description: Test Filter op basic usage
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestFilterSuccess1) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestFilterSuccess1.";
// Test basic filter api with specific predicate to judge if label is equal to 3
@ -672,7 +729,7 @@ TEST_F(MindDataTestPipeline, TestFilterSuccess1) {
std::shared_ptr<TensorTransform> decode_op = std::make_shared<vision::Decode>(true);
EXPECT_NE(decode_op, nullptr);
std::shared_ptr<TensorTransform> resize_op(new vision::Resize({64, 64}));
auto resize_op = std::make_shared<vision::Resize>(std::vector<int32_t>{64, 64});
EXPECT_NE(resize_op, nullptr);
// Create a Map operation on ds
@ -715,6 +772,9 @@ TEST_F(MindDataTestPipeline, TestFilterSuccess1) {
iter->Stop();
}
/// Feature: Filter op
/// Description: Test Filter op without input_columns
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestFilterSuccess2) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestFilterSuccess2.";
// Test filter api without input_columns
@ -762,6 +822,9 @@ TEST_F(MindDataTestPipeline, TestFilterSuccess2) {
iter->Stop();
}
/// Feature: Filter op
/// Description: Test Filter op with nullptr predicate
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestFilterFail1) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestFilterFail1.";
// Test filter api with nullptr predicate
@ -784,6 +847,9 @@ TEST_F(MindDataTestPipeline, TestFilterFail1) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: Filter op
/// Description: Test Filter op with wrong input_columns
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestFilterFail2) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestFilterFail2.";
// Test filter api with wrong input_columns
@ -820,6 +886,9 @@ TEST_F(MindDataTestPipeline, TestFilterFail2) {
iter->Stop();
}
/// Feature: Filter op
/// Description: Test Filter op with empty string as column name
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestFilterFail3) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestFilterFail3.";
// Test filter api with empty input_columns
@ -840,6 +909,10 @@ TEST_F(MindDataTestPipeline, TestFilterFail3) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: Test ImageFolder with Batch and Repeat operations
/// Description: Perform Repeat and Batch ops based on repeat_count, batch_size, num_samples, and replacement,
/// iterate through dataset and count rows
/// Expectation: Output is equal to the expected output
void ImageFolderBatchAndRepeat(int32_t repeat_count, int32_t batch_size, int64_t num_samples,
bool replacement, std::string datasets_root_path) {
// Create an ImageFolder Dataset
@ -891,11 +964,9 @@ void ImageFolderBatchAndRepeat(int32_t repeat_count, int32_t batch_size, int64_t
iter->Stop();
}
// Feature: Test ImageFolder with Batch and Repeat operations
// Description: Perform Repeat and Batch ops with varying parameters,
// iterate through dataset and count rows
// Expectation: Number of rows should be equal to the size of the dataset/num_samples
// times the repeat_count divided by the batch_size
/// Feature: Test ImageFolder with Batch and Repeat operations
/// Description: Perform Repeat and Batch ops with varying parameters, iterate through dataset and count rows
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestImageFolderBatchAndRepeat) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestImageFolderBatchAndRepeat.";
ImageFolderBatchAndRepeat(2, 2, 10, false, datasets_root_path_);
@ -903,6 +974,9 @@ TEST_F(MindDataTestPipeline, TestImageFolderBatchAndRepeat) {
ImageFolderBatchAndRepeat(3, 2, 12, true, datasets_root_path_);
}
/// Feature: Test ImageFolder with Batch and Repeat operations
/// Description: Test ImageFolder with Repeat and Batch operations, followed by GetDatasetSize
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestPipelineGetDatasetSize) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestPipelineGetDatasetSize.";
@ -924,6 +998,9 @@ TEST_F(MindDataTestPipeline, TestPipelineGetDatasetSize) {
EXPECT_EQ(ds->GetDatasetSize(), 10);
}
/// Feature: GetDatasetSize
/// Description: Test distributed ImageFolder where num_per_shard is more than num_samples, followed by GetDatasetSize
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestDistributedGetDatasetSize1) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestDistributedGetDatasetSize1.";
// Test get dataset size in distributed scenario when num_per_shard is more than num_samples
@ -955,6 +1032,9 @@ TEST_F(MindDataTestPipeline, TestDistributedGetDatasetSize1) {
EXPECT_EQ(i, 10);
}
/// Feature: GetDatasetSize
/// Description: Test distributed ImageFolder where num_per_shard is less than num_samples, followed by GetDatasetSize
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestDistributedGetDatasetSize2) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestDistributedGetDatasetSize2.";
// Test get dataset size in distributed scenario when num_per_shard is less than num_samples
@ -986,6 +1066,9 @@ TEST_F(MindDataTestPipeline, TestDistributedGetDatasetSize2) {
EXPECT_EQ(i, 11);
}
/// Feature: Project and Map ops
/// Description: Test Project op after a Map op
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestProjectMap) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestProjectMap.";
@ -1040,6 +1123,9 @@ TEST_F(MindDataTestPipeline, TestProjectMap) {
iter->Stop();
}
/// Feature: Project op
/// Description: Test Project op with duplicate column name
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestProjectDuplicateColumnFail) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestProjectDuplicateColumnFail.";
@ -1069,6 +1155,9 @@ TEST_F(MindDataTestPipeline, TestProjectDuplicateColumnFail) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: Map op
/// Description: Test Map op with duplicate column name
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestMapDuplicateColumnFail) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestMapDuplicateColumnFail.";
@ -1109,6 +1198,9 @@ TEST_F(MindDataTestPipeline, TestMapDuplicateColumnFail) {
EXPECT_EQ(iter3, nullptr);
}
/// Feature: Map op
/// Description: Test Map op with nullptr as the operation
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestMapNullOperation) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestMapNullOperation.";
@ -1128,6 +1220,9 @@ TEST_F(MindDataTestPipeline, TestMapNullOperation) {
EXPECT_EQ(iter1, nullptr);
}
/// Feature: Project and Map ops
/// Description: Test auto injection of Project op after Map op
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestProjectMapAutoInjection) {
MS_LOG(INFO) << "Doing MindDataTestPipeline.TestProjectMapAutoInjection";
@ -1142,7 +1237,7 @@ TEST_F(MindDataTestPipeline, TestProjectMapAutoInjection) {
EXPECT_NE(ds, nullptr);
// Create objects for the tensor ops
std::shared_ptr<TensorTransform> resize_op(new vision::Resize({30, 30}));
auto resize_op = std::make_shared<vision::Resize>(std::vector<int32_t>{30, 30});
EXPECT_NE(resize_op, nullptr);
// Create a Map operation on ds
@ -1179,6 +1274,9 @@ TEST_F(MindDataTestPipeline, TestProjectMapAutoInjection) {
iter->Stop();
}
/// Feature: Rename op
/// Description: Test Rename op where input and output in Rename are not the same size
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestRenameFail1) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRenameFail1.";
// We expect this test to fail because input and output in Rename are not the same size
@ -1203,6 +1301,9 @@ TEST_F(MindDataTestPipeline, TestRenameFail1) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: Rename op
/// Description: Test Rename op where input or output column name is empty
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestRenameFail2) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRenameFail2.";
// We expect this test to fail because input or output column name is empty
@ -1222,6 +1323,9 @@ TEST_F(MindDataTestPipeline, TestRenameFail2) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: Rename op
/// Description: Test Rename op with duplicate column name
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestRenameFail3) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRenameFail3.";
// We expect this test to fail because duplicate column name
@ -1250,6 +1354,9 @@ TEST_F(MindDataTestPipeline, TestRenameFail3) {
EXPECT_EQ(iter2, nullptr);
}
/// Feature: Rename op
/// Description: Test Rename op basic usage
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestRenameSuccess) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRenameSuccess.";
@ -1300,6 +1407,9 @@ TEST_F(MindDataTestPipeline, TestRenameSuccess) {
iter->Stop();
}
/// Feature: Repeat op
/// Description: Test Repeat op with default inputs (repeat count is -1)
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestRepeatDefault) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRepeatDefault.";
@ -1343,6 +1453,9 @@ TEST_F(MindDataTestPipeline, TestRepeatDefault) {
iter->Stop();
}
/// Feature: Repeat op
/// Description: Test Repeat op with repeat count to be 1
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestRepeatOne) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRepeatOne.";
@ -1382,6 +1495,9 @@ TEST_F(MindDataTestPipeline, TestRepeatOne) {
iter->Stop();
}
/// Feature: Repeat op
/// Description: Test Repeat op with invalid repeat_num=0
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestRepeatFail1) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRepeatFail1.";
@ -1401,6 +1517,9 @@ TEST_F(MindDataTestPipeline, TestRepeatFail1) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: Repeat op
/// Description: Test Repeat op with invalid repeat_num=-2
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestRepeatFail2) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRepeatFail2.";
// This case is expected to fail because the repeat count is invalid (<-1 && !=0).
@ -1421,6 +1540,9 @@ TEST_F(MindDataTestPipeline, TestRepeatFail2) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: Shuffle op
/// Description: Test Shuffle op on ImageFolderDataset
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestShuffleDataset) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestShuffleDataset.";
@ -1467,7 +1589,9 @@ TEST_F(MindDataTestPipeline, TestShuffleDataset) {
iter->Stop();
}
/// Feature: Test shuffle operation on TFRecord dataset
/// Description: Iterate through dataset with a shuffle size of shuffle_size and count the number of rows
/// Expectation: There should be 10 rows in the dataset
void TestShuffleTFRecord(int32_t shuffle_size, std::string dataset_root_path) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestShuffleTFRecord.";
@ -1501,9 +1625,9 @@ void TestShuffleTFRecord(int32_t shuffle_size, std::string dataset_root_path) {
iter->Stop();
}
// Feature: Test shuffle operation on TFRecord dataset
// Description: Iterate through dataset with a shuffle size of 4 and 100 and count the number of rows
// Expectation: There should be 10 rows in the dataset
/// Feature: Test shuffle operation on TFRecord dataset
/// Description: Iterate through dataset with a shuffle size of 4 and 100 and count the number of rows
/// Expectation: There should be 10 rows in the dataset
TEST_F(MindDataTestPipeline, TestShuffleTFRecord) {
TestShuffleTFRecord(4, datasets_root_path_);
TestShuffleTFRecord(100, datasets_root_path_);
@ -1547,6 +1671,9 @@ TEST_F(MindDataTestPipeline, TestSkipDataset) {
iter->Stop();
}
/// Feature: Skip, Take, Repeat ops
/// Description: Test Skip, Project, Take, then Repeat op
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestSkipTakeRepeat) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSkipTakeRepeat.";
@ -1592,6 +1719,9 @@ TEST_F(MindDataTestPipeline, TestSkipTakeRepeat) {
iter->Stop();
}
/// Feature: Skip op
/// Description: Test Skip op followed by GetDatasetSize
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestSkipGetDatasetSize) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSkipGetDatasetSize.";
@ -1608,6 +1738,9 @@ TEST_F(MindDataTestPipeline, TestSkipGetDatasetSize) {
EXPECT_EQ(ds->GetDatasetSize(), 7);
}
/// Feature: Skip op
/// Description: Test Skip op with invalid count input
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestSkipDatasetError1) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSkipDatasetError1.";
@ -1627,6 +1760,9 @@ TEST_F(MindDataTestPipeline, TestSkipDatasetError1) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: Take op
/// Description: Test Take op with default count=-1
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestTakeDatasetDefault) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestTakeDatasetDefault.";
@ -1664,6 +1800,9 @@ TEST_F(MindDataTestPipeline, TestTakeDatasetDefault) {
iter->Stop();
}
/// Feature: Take op
/// Description: Test Take op followed by GetDatasetSize
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestTakeGetDatasetSize) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestTakeGetDatasetSize.";
@ -1679,6 +1818,9 @@ TEST_F(MindDataTestPipeline, TestTakeGetDatasetSize) {
EXPECT_EQ(ds->GetDatasetSize(), 2);
}
/// Feature: Take op
/// Description: Test Take op with invalid count input
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestTakeDatasetError1) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestTakeDatasetError1.";
@ -1708,6 +1850,9 @@ TEST_F(MindDataTestPipeline, TestTakeDatasetError1) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: Take op
/// Description: Test Take op with valid count input
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestTakeDatasetNormal) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestTakeDatasetNormal.";
@ -1745,6 +1890,9 @@ TEST_F(MindDataTestPipeline, TestTakeDatasetNormal) {
iter->Stop();
}
/// Feature: Tensor and Map ops
/// Description: Test Tensor and Map ops
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestTensorOpsAndMap) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestTensorOpsAndMap.";
@ -1759,10 +1907,10 @@ TEST_F(MindDataTestPipeline, TestTensorOpsAndMap) {
EXPECT_NE(ds, nullptr);
// Create objects for the tensor ops
std::shared_ptr<TensorTransform> resize_op(new vision::Resize({30, 30}));
auto resize_op = std::make_shared<vision::Resize>(std::vector<int32_t>{30, 30});
EXPECT_NE(resize_op, nullptr);
std::shared_ptr<TensorTransform> center_crop_op(new vision::CenterCrop({16, 16}));
auto center_crop_op = std::make_shared<vision::CenterCrop>(std::vector<int32_t>{16, 16});
EXPECT_NE(center_crop_op, nullptr);
// Create a Map operation on ds
@ -1797,6 +1945,9 @@ TEST_F(MindDataTestPipeline, TestTensorOpsAndMap) {
iter->Stop();
}
/// Feature: Zip op
/// Description: Test Zip op with datasets that have image and label columns (same column names)
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestZipFail) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestZipFail.";
// We expect this test to fail because we are the both datasets we are zipping have "image" and "label" columns
@ -1826,6 +1977,9 @@ TEST_F(MindDataTestPipeline, TestZipFail) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: Zip op
/// Description: Test Zip op with empty input dataset
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestZipFail2) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestZipFail2.";
// This case is expected to fail because the input dataset is empty.
@ -1846,6 +2000,9 @@ TEST_F(MindDataTestPipeline, TestZipFail2) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: Zip op
/// Description: Test Zip op basic usage
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestZipSuccess) {
// Testing the member zip() function
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestZipSuccess.";
@ -1916,6 +2073,9 @@ TEST_F(MindDataTestPipeline, TestZipSuccess) {
iter->Stop();
}
/// Feature: Zip op
/// Description: Test Zip op followed by GetDatasetSize
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestZipGetDatasetSize) {
// Testing the member zip() function
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestZipGetDatasetSize.";
@ -1954,6 +2114,9 @@ TEST_F(MindDataTestPipeline, TestZipGetDatasetSize) {
EXPECT_EQ(ds->GetDatasetSize(), 2);
}
/// Feature: Zip op
/// Description: Test Zip op using static zip() function
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestZipSuccess2) {
// Testing the static zip() function
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestZipSuccess2.";
@ -2008,6 +2171,9 @@ TEST_F(MindDataTestPipeline, TestZipSuccess2) {
iter->Stop();
}
/// Feature: SetNumWorkers op
/// Description: Test SetNumWorkers with various inputs
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestNumWorkersValidate) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestNumWorkersValidate.";
@ -2035,7 +2201,7 @@ TEST_F(MindDataTestPipeline, TestNumWorkersValidate) {
}
}
// Feature: Test Conact operation on TFRecord dataset
// Feature: Test Concat operation on TFRecord dataset
// Description: Perform Concat on two identical datasets, iterate through the product and count rows
// Expectation: There should be 2 rows in the concatenated dataset (2 times original size)
TEST_F(MindDataTestPipeline, TestConcatTFRecord) {
@ -2233,8 +2399,8 @@ TEST_F(MindDataTestPipeline, TestTFRecordRename) {
}
// Feature: Test TFRecord with Zip and Repeat operation
// Description: Create two datasets and apply Zip operation on them.
// Apply Repeat operation on resulting dataset and count rows
// Description: Create two datasets and apply Zip operation on them.
// Apply Repeat operation on resulting dataset and count rows
// Expectation: There should be 9 rows in the dataset
TEST_F(MindDataTestPipeline, TestTFRecordZip) {
// Testing the member zip() function
@ -2386,6 +2552,9 @@ TEST_F(MindDataTestPipeline, TestBatch) {
iter->Stop();
}
/// Feature: Test Repeat and Batch on TFRecord
/// Description: Apply repeat then batch with drop=drop, count rows in the dataset
/// Expectation: The number of rows should equal the expected_rows
void TestRepeatBatch(bool drop, uint64_t expected_rows, std::string datasets_root_path) {
// Create a TFRecord Dataset
std::string file_path = datasets_root_path + "/testBatchDataset/test.data";
@ -2423,15 +2592,18 @@ void TestRepeatBatch(bool drop, uint64_t expected_rows, std::string datasets_roo
iter->Stop();
}
// Feature: Test Repeat and Batch on TFRecord
// Description: Apply repeat then batch with drop on and off, count rows in the dataset
// Expectation: The number of rows should equal the expected number of rows
/// Feature: Test Repeat and Batch on TFRecord
/// Description: Apply repeat then batch with drop on and off, count rows in the dataset
/// Expectation: The number of rows should equal the expected number of rows
TEST_F(MindDataTestPipeline, TestRepeatBatchDrop) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRepeatBatchDrop.";
TestRepeatBatch(true, 3, datasets_root_path_);
TestRepeatBatch(false, 4, datasets_root_path_);
}
/// Feature: Test Batch and Repeat on TFRecord
/// Description: Apply batch then repeat with drop=drop, count rows in the dataset
/// Expectation: The number of rows should equal the expected_rows
void TestBatchRepeat(bool drop, uint64_t expected_rows, std::string datasets_root_path) {
// Create a TFRecord Dataset
std::string file_path = datasets_root_path + "/testBatchDataset/test.data";
@ -2469,9 +2641,9 @@ void TestBatchRepeat(bool drop, uint64_t expected_rows, std::string datasets_roo
iter->Stop();
}
// Feature: Test Batch and Repeat on TFRecord
// Description: Apply batch then repeat with drop on and off, count rows in the dataset
// Expectation: The number of rows should equal the expected number of rows
/// Feature: Test Batch and Repeat on TFRecord
/// Description: Apply batch then repeat with drop on and off, count rows in the dataset
/// Expectation: The number of rows should equal the expected number of rows
TEST_F(MindDataTestPipeline, TestBatchDropRepeat) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestBatchDropRepeat.";
TestBatchRepeat(true, 2, datasets_root_path_);

View File

@ -1,5 +1,5 @@
/**
* Copyright 2021 Huawei Technologies Co., Ltd
* Copyright 2021-2022 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -25,9 +25,9 @@ class MindDataTestPipeline : public UT::DatasetOpTesting {
protected:
};
/// Feature: Test PennTreebank Dataset.
/// Description: read PennTreebank data and get data.
/// Expectation: the data is processed successfully.
/// Feature: PennTreebankDataset
/// Description: Test PennTreebankDataset basic usage
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestPennTreebankDatasetBasic) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestPennTreebankDatasetBasic.";
// Test PennTreebank Dataset with single text file and many default inputs
@ -84,9 +84,9 @@ TEST_F(MindDataTestPipeline, TestPennTreebankDatasetBasic) {
GlobalContext::config_manager()->set_num_parallel_workers(original_num_parallel_workers);
}
/// Feature: Test PennTreebank Dataset.
/// Description: read PennTreebank data and get data.
/// Expectation: the data is processed successfully.
/// Feature: PennTreebankDataset
/// Description: Test PennTreebankDataset in pipeline mode
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestPennTreebankDatasetBasicWithPipeline) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestPennTreebankDatasetBasicWithPipeline.";
// Test PennTreebank Dataset with single text file and many default inputs
@ -151,9 +151,9 @@ TEST_F(MindDataTestPipeline, TestPennTreebankDatasetBasicWithPipeline) {
GlobalContext::config_manager()->set_num_parallel_workers(original_num_parallel_workers);
}
/// Feature: TestPennTreebankDatasetIteratorOneColumn.
/// Description: test iterator of PennTreebankDataset with only the "text" column.
/// Expectation: get correct data.
/// Feature: PennTreebankDataset
/// Description: Test iterator of PennTreebankDataset with only text column
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestPennTreebankDatasetIteratorOneColumn) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestPennTreebankDatasetIteratorOneColumn.";
// Create a PennTreebank dataset
@ -197,9 +197,9 @@ TEST_F(MindDataTestPipeline, TestPennTreebankDatasetIteratorOneColumn) {
iter->Stop();
}
/// Feature: TestPennTreebankDatasetIteratorWrongColumn.
/// Description: test iterator of PennTreebankDataset with wrong column.
/// Expectation: get none piece of data.
/// Feature: PennTreebankDataset
/// Description: Test iterator of PennTreebankDataset with wrong column
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestPennTreebankDatasetIteratorWrongColumn) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestPennTreebankDatasetIteratorWrongColumn.";
// Create a PennTreebank dataset
@ -220,9 +220,9 @@ TEST_F(MindDataTestPipeline, TestPennTreebankDatasetIteratorWrongColumn) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: Test PennTreebank Dataset.
/// Description: read PennTreebank data and get data.
/// Expectation: the data is processed successfully.
/// Feature: PennTreebankDataset
/// Description: Test PennTreebankDataset Getters method
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestPennTreebankGetters) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestPennTreebankGetters.";
// Test PennTreebank Dataset with single text file and many default inputs
@ -258,9 +258,9 @@ TEST_F(MindDataTestPipeline, TestPennTreebankGetters) {
GlobalContext::config_manager()->set_num_parallel_workers(original_num_parallel_workers);
}
/// Feature: Test PennTreebank Dataset.
/// Description: Testing abnormal inputs.
/// Expectation: Exception thrown to be caught.
/// Feature: PennTreebankDataset
/// Description: Test PennTreebankDataset with invalid samplers
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestPennTreebankDatasetFail1) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestPennTreebankDatasetFail1.";
@ -276,9 +276,9 @@ TEST_F(MindDataTestPipeline, TestPennTreebankDatasetFail1) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: Test PennTreebank Dataset.
/// Description: Testing abnormal inputs.
/// Expectation: Exception thrown to be caught.
/// Feature: PennTreebankDataset
/// Description: Test PennTreebankDataset with empty dataset_files input
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestPennTreebankDatasetFail2) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestPennTreebankDatasetFail2.";
@ -294,9 +294,9 @@ TEST_F(MindDataTestPipeline, TestPennTreebankDatasetFail2) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: Test PennTreebank Dataset.
/// Description: Testing abnormal inputs.
/// Expectation: Exception thrown to be caught.
/// Feature: PennTreebankDataset
/// Description: Test PennTreebankDataset with non-existent dataset_files input
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestPennTreebankDatasetFail3) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestPennTreebankDatasetFail3.";
@ -312,9 +312,9 @@ TEST_F(MindDataTestPipeline, TestPennTreebankDatasetFail3) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: Test PennTreebank Dataset.
/// Description: Testing abnormal inputs.
/// Expectation: Exception thrown to be caught.
/// Feature: PennTreebankDataset
/// Description: Test PennTreebankDataset with empty string dataset_files input
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestPennTreebankDatasetFail4) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestPennTreebankDatasetFail4.";
@ -330,9 +330,9 @@ TEST_F(MindDataTestPipeline, TestPennTreebankDatasetFail4) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: Test PennTreebank Dataset.
/// Description: Testing abnormal inputs.
/// Expectation: Exception thrown to be caught.
/// Feature: PennTreebankDataset
/// Description: Test PennTreebankDataset with invalid num_shards=0
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestPennTreebankDatasetFail5) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestPennTreebankDatasetFail5.";
@ -348,9 +348,9 @@ TEST_F(MindDataTestPipeline, TestPennTreebankDatasetFail5) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: Test PennTreebank Dataset.
/// Description: Testing abnormal inputs.
/// Expectation: Exception thrown to be caught.
/// Feature: PennTreebankDataset
/// Description: Test PennTreebankDataset with invalid shard_id=-1
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestPennTreebankDatasetFail6) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestPennTreebankDatasetFail6.";
@ -366,9 +366,9 @@ TEST_F(MindDataTestPipeline, TestPennTreebankDatasetFail6) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: Test PennTreebank Dataset.
/// Description: Testing abnormal inputs.
/// Expectation: Exception thrown to be caught.
/// Feature: PennTreebankDataset
/// Description: Test PennTreebankDataset with invalid shard_id=2 and num_shards=2 combination
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestPennTreebankDatasetFail7) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestPennTreebankDatasetFail7.";
@ -384,9 +384,9 @@ TEST_F(MindDataTestPipeline, TestPennTreebankDatasetFail7) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: Test PennTreebank Dataset.
/// Description: Testing abnormal inputs.
/// Expectation: Exception thrown to be caught.
/// Feature: PennTreebankDataset
/// Description: Test PennTreebankDataset with ShuffleMode::kFalse
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestPennTreebankDatasetShuffleFalse) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestPennTreebankDatasetShuffleFalse.";
@ -451,9 +451,9 @@ TEST_F(MindDataTestPipeline, TestPennTreebankDatasetShuffleFalse) {
GlobalContext::config_manager()->set_num_parallel_workers(original_num_parallel_workers);
}
/// Feature: Test PennTreebank Dataset.
/// Description: read PennTreebank data and get data.
/// Expectation: the data is processed successfully.
/// Feature: PennTreebankDataset
/// Description: Test PennTreebankDataset with ShuffleMode::kFiles
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestPennTreebankDatasetShuffleFilesA) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestPennTreebankDatasetShuffleFilesA.";
@ -518,9 +518,9 @@ TEST_F(MindDataTestPipeline, TestPennTreebankDatasetShuffleFilesA) {
GlobalContext::config_manager()->set_num_parallel_workers(original_num_parallel_workers);
}
/// Feature: Test PennTreebank Dataset.
/// Description: read PennTreebank data and get data.
/// Expectation: the data is processed successfully.
/// Feature: PennTreebankDataset
/// Description: Test PennTreebankDataset with ShuffleMode::kInfile
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestPennTreebankDatasetShuffleFilesB) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestPennTreebankDatasetShuffleFilesB.";
@ -585,9 +585,9 @@ TEST_F(MindDataTestPipeline, TestPennTreebankDatasetShuffleFilesB) {
GlobalContext::config_manager()->set_num_parallel_workers(original_num_parallel_workers);
}
/// Feature: Test PennTreebank Dataset.
/// Description: read PennTreebank data and get data.
/// Expectation: the data is processed successfully.
/// Feature: PennTreebankDataset
/// Description: Test PennTreebankDataset with ShuffleMode::kGlobal
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestPennTreebankDatasetShuffleGlobal) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestPennTreebankDatasetShuffleGlobal.";

View File

@ -1,5 +1,5 @@
/**
* Copyright 2021 Huawei Technologies Co., Ltd
* Copyright 2021-2022 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -25,9 +25,9 @@ class MindDataTestPipeline : public UT::DatasetOpTesting {
protected:
};
/// Feature: PhotoTourTrainDataset.
/// Description: test basic usage of PhotoTourTrainDataset.
/// Expectation: get correct number of data.
/// Feature: PhotoTourDataset
/// Description: Test basic usage of PhotoTourDataset with train dataset
/// Expectation: Get correct number of data
TEST_F(MindDataTestPipeline, TestPhotoTourTrainDataset) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestPhotoTourTrainDataset.";
@ -61,9 +61,9 @@ TEST_F(MindDataTestPipeline, TestPhotoTourTrainDataset) {
iter->Stop();
}
/// Feature: PhotoTourTestDataset.
/// Description: test basic usage of PhotoTourTestDataset.
/// Expectation: get correct number of data.
/// Feature: PhotoTourDataset
/// Description: Test basic usage of PhotoTourDataset with test dataset
/// Expectation: Get correct number of data
TEST_F(MindDataTestPipeline, TestPhotoTourTestDataset) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestPhotoTourTestDataset.";
@ -99,9 +99,9 @@ TEST_F(MindDataTestPipeline, TestPhotoTourTestDataset) {
iter->Stop();
}
/// Feature: PhotoTourTrainDatasetWithPipeline.
/// Description: test usage of PhotoTourTrainDataset with pipeline.
/// Expectation: get correct number of data.
/// Feature: PhotoTourDataset
/// Description: Test usage of PhotoTourDataset in pipeline mode with train dataset
/// Expectation: Get correct number of data
TEST_F(MindDataTestPipeline, TestPhotoTourTrainDatasetWithPipeline) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestPhotoTourTrainDatasetWithPipeline.";
@ -156,9 +156,9 @@ TEST_F(MindDataTestPipeline, TestPhotoTourTrainDatasetWithPipeline) {
iter->Stop();
}
/// Feature: PhotoTourIteratorOneColumn.
/// Description: test iterator of PhotoTourDataset with only the "image" column.
/// Expectation: get correct data.
/// Feature: PhotoTourDataset
/// Description: Test iterator of PhotoTourDataset with only the image column
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestPhotoTourIteratorOneColumn) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestPhotoTourIteratorOneColumn.";
// Create a PhotoTour Dataset
@ -198,9 +198,9 @@ TEST_F(MindDataTestPipeline, TestPhotoTourIteratorOneColumn) {
iter->Stop();
}
/// Feature: PhotoTourIteratorWrongColumn.
/// Description: test iterator of PhotoTourDataset with wrong column.
/// Expectation: get none piece of data.
/// Feature: PhotoTourDataset
/// Description: Test iterator of PhotoTourDataset with wrong column
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestPhotoTourIteratorWrongColumn) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestPhotoTourIteratorWrongColumn.";
// Create a PhotoTour Dataset
@ -214,9 +214,9 @@ TEST_F(MindDataTestPipeline, TestPhotoTourIteratorWrongColumn) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: PhotoTourTrainDatasetSize.
/// Description: test usage of get the size of PhotoTourTrainDataset.
/// Expectation: get correct number of data.
/// Feature: PhotoTourDataset
/// Description: Test PhotoTourDataset GetDatasetSize
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestGetPhotoTourTrainDatasetSize) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestGetPhotoTourTrainDatasetSize.";
@ -228,9 +228,9 @@ TEST_F(MindDataTestPipeline, TestGetPhotoTourTrainDatasetSize) {
EXPECT_EQ(ds->GetDatasetSize(), 100);
}
/// Feature: PhotoTourTrainDatasetGetters.
/// Description: test usage of getters PhotoTourTrainDataset.
/// Expectation: get correct number of data and correct tensor shape.
/// Feature: PhotoTourDataset
/// Description: Test PhotoTourDataset Getters method
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestPhotoTourTrainDatasetGetters) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestPhotoTourTrainDatasetGetters.";
@ -267,9 +267,9 @@ TEST_F(MindDataTestPipeline, TestPhotoTourTrainDatasetGetters) {
EXPECT_EQ(ds->GetDatasetSize(), 100);
}
/// Feature: PhotoTourDatasetFail.
/// Description: test failure of PhotoTourDataset.
/// Expectation: get none piece of data.
/// Feature: PhotoTourDataset
/// Description: Test PhotoTourDataset with invalid folder path input
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestPhotoTourDatasetFail) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestPhotoTourDatasetFail.";
@ -283,9 +283,9 @@ TEST_F(MindDataTestPipeline, TestPhotoTourDatasetFail) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: PhotoTourDatasetWithInvalidUsageFail.
/// Description: test failure of PhotoTourDataset with invalid usage.
/// Expectation: get none piece of data.
/// Feature: PhotoTourDataset
/// Description: Test PhotoTourDataset with invalid usage
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestPhotoTourDatasetWithInvalidUsageFail) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestPhotoTourDatasetWithInvalidUsageFail.";
@ -300,9 +300,9 @@ TEST_F(MindDataTestPipeline, TestPhotoTourDatasetWithInvalidUsageFail) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: PhotoTourDatasetWithNullSamplerFail.
/// Description: test failure of PhotoTourDataset with null sampler.
/// Expectation: get none piece of data.
/// Feature: PhotoTourDataset
/// Description: Test PhotoTourDataset with null sampler
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestPhotoTourDatasetWithNullSamplerFail) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestPhotoTourDatasetWithNullSamplerFail.";

View File

@ -1,5 +1,5 @@
/**
* Copyright 2021 Huawei Technologies Co., Ltd
* Copyright 2021-2022 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -26,9 +26,9 @@ class MindDataTestPipeline : public UT::DatasetOpTesting {
protected:
};
/// Feature: Places365TrainStandardDataset.
/// Description: test basic usage of Places365TrainStandardDataset.
/// Expectation: get correct number of data.
/// Feature: Places365Dataset
/// Description: Test basic usage of Places365Dataset with train-standard dataset
/// Expectation: The dataset is processed successfully
TEST_F(MindDataTestPipeline, TestPlaces365TrainStandardDataset) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestPlaces365TrainStandardDataset.";
@ -64,9 +64,9 @@ TEST_F(MindDataTestPipeline, TestPlaces365TrainStandardDataset) {
iter->Stop();
}
/// Feature: Places365TrainChallengeDataset.
/// Description: test basic usage of Places365TrainChallengeDataset.
/// Expectation: get correct number of data.
/// Feature: Places365Dataset
/// Description: Test basic usage of Places365Dataset with train-challenge dataset
/// Expectation: The dataset is processed successfully
TEST_F(MindDataTestPipeline, TestPlaces365TrainChallengeDataset) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestPlaces365TrainChallengeDataset.";
@ -102,9 +102,9 @@ TEST_F(MindDataTestPipeline, TestPlaces365TrainChallengeDataset) {
iter->Stop();
}
/// Feature: Places365ValDataset.
/// Description: test basic usage of Places365ValDataset.
/// Expectation: get correct number of data.
/// Feature: Places365Dataset
/// Description: Test basic usage of Places365Dataset with val dataset
/// Expectation: The dataset is processed successfully
TEST_F(MindDataTestPipeline, TestPlaces365ValDataset) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestPlaces365ValDataset.";
@ -139,9 +139,9 @@ TEST_F(MindDataTestPipeline, TestPlaces365ValDataset) {
iter->Stop();
}
/// Feature: Places365TrainDatasetWithPipeline.
/// Description: test usage of Places365TrainDataset pith pipeline.
/// Expectation: get correct number of data.
/// Feature: Places365Dataset
/// Description: Test usage of Places365Dataset with pipeline mode with train-standard dataset
/// Expectation: The dataset is processed successfully
TEST_F(MindDataTestPipeline, TestPlaces365TrainDatasetWithPipeline) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestPlaces365TrainDatasetWithPipeline.";
@ -199,9 +199,9 @@ TEST_F(MindDataTestPipeline, TestPlaces365TrainDatasetWithPipeline) {
iter->Stop();
}
/// Feature: Places365IteratorOneColumn.
/// Description: test iterator of Places365Dataset with only the "image" column.
/// Expectation: get correct data.
/// Feature: Places365Dataset
/// Description: Test iterator of Places365Dataset with only the image column
/// Expectation: The dataset is processed successfully
TEST_F(MindDataTestPipeline, TestPlaces365IteratorOneColumn) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestPlaces365IteratorOneColumn.";
// Create a Places365 Dataset
@ -242,9 +242,9 @@ TEST_F(MindDataTestPipeline, TestPlaces365IteratorOneColumn) {
iter->Stop();
}
/// Feature: Places365IteratorWrongColumn.
/// Description: test iterator of Places365Dataset with wrong column.
/// Expectation: get none piece of data.
/// Feature: Places365Dataset
/// Description: Test iterator of Places365Dataset with wrong column
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestPlaces365IteratorWrongColumn) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestPlaces365IteratorWrongColumn.";
// Create a Places365 Dataset
@ -259,9 +259,9 @@ TEST_F(MindDataTestPipeline, TestPlaces365IteratorWrongColumn) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: Places365TrainDatasetSize.
/// Description: test usage of get the size of Places365TrainDataset.
/// Expectation: get correct number of data.
/// Feature: Places365Dataset
/// Description: Test usage of GetDatasetSize of Places365TrainDataset
/// Expectation: Get the correct size
TEST_F(MindDataTestPipeline, TestGetPlaces365TrainDatasetSize) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestGetPlaces365TrainDatasetSize.";
@ -273,9 +273,9 @@ TEST_F(MindDataTestPipeline, TestGetPlaces365TrainDatasetSize) {
EXPECT_EQ(ds->GetDatasetSize(), 4);
}
/// Feature: Places365TrainDatasetGetters.
/// Description: test usage of getters Places365TrainDataset.
/// Expectation: get correct number of data and correct tensor shape.
/// Feature: Places365Dataset
/// Description: Test Places365Dataset Getters method
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestPlaces365TrainDatasetGetters) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestPlaces365TrainDatasetGetters.";
@ -314,9 +314,9 @@ TEST_F(MindDataTestPipeline, TestPlaces365TrainDatasetGetters) {
EXPECT_EQ(ds->GetDatasetSize(), 4);
}
/// Feature: Places365DatasetFail.
/// Description: test failure of Places365Dataset.
/// Expectation: get none piece of data.
/// Feature: Places365Dataset
/// Description: Test Places365Dataset with invalid folder path input
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestPlaces365DatasetFail) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestPlaces365DatasetFail.";
@ -330,9 +330,9 @@ TEST_F(MindDataTestPipeline, TestPlaces365DatasetFail) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: Places365DatasetWithInvalidUsageFail.
/// Description: test failure of Places365Dataset with invalid usage.
/// Expectation: get none piece of data.
/// Feature: Places365Dataset
/// Description: Test Places365Dataset with invalid usage
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestPlaces365DatasetWithInvalidUsageFail) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestPlaces365DatasetWithInvalidUsageFail.";
@ -347,9 +347,9 @@ TEST_F(MindDataTestPipeline, TestPlaces365DatasetWithInvalidUsageFail) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: Places365DatasetWithNullSamplerFail.
/// Description: test failure of Places365Dataset with null sampler.
/// Expectation: get none piece of data.
/// Feature: Places365Dataset
/// Description: Test Places365Dataset with null sampler
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestPlaces365DatasetWithNullSamplerFail) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestPlaces365DatasetWithNullSamplerFail.";

View File

@ -1,5 +1,5 @@
/**
* Copyright 2021 Huawei Technologies Co., Ltd
* Copyright 2021-2022 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -26,8 +26,8 @@ class MindDataTestPipeline : public UT::DatasetOpTesting {
};
/// Feature: QMnistTrainDataset.
/// Description: test basic usage of QMnistTrainDataset.
/// Expectation: get correct number of data.
/// Description: Test basic usage of QMnistTrainDataset.
/// Expectation: Get correct number of data.
TEST_F(MindDataTestPipeline, TestQMnistTrainDataset) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestQMnistTrainDataset.";
@ -62,9 +62,9 @@ TEST_F(MindDataTestPipeline, TestQMnistTrainDataset) {
iter->Stop();
}
/// Feature: QMnistTestDataset.
/// Description: test basic usage of QMnistTestDataset.
/// Expectation: get correct number of data.
/// Feature: QMnistTestDataset
/// Description: Test basic usage of QMnistDataset with test dataset
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestQMnistTestDataset) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestQMnistTestDataset.";
@ -99,9 +99,9 @@ TEST_F(MindDataTestPipeline, TestQMnistTestDataset) {
iter->Stop();
}
/// Feature: QMnistNistDataset.
/// Description: test basic usage of QMnistNistDataset.
/// Expectation: get correct number of data.
/// Feature: QMnistTestDataset
/// Description: Test basic usage of QMnistDataset with nist dataset
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestQMnistNistDataset) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestQMnistNistDataset.";
@ -136,9 +136,9 @@ TEST_F(MindDataTestPipeline, TestQMnistNistDataset) {
iter->Stop();
}
/// Feature: QMnistAllDataset.
/// Description: test basic usage of QMnistAllDataset.
/// Expectation: get correct number of data.
/// Feature: QMnistTestDataset
/// Description: Test basic usage of QMnistDataset with all dataset
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestQMnistAllDataset) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestQMnistAllDataset.";
@ -173,9 +173,9 @@ TEST_F(MindDataTestPipeline, TestQMnistAllDataset) {
iter->Stop();
}
/// Feature: QMnistCompatDataset.
/// Description: test basic usage of QMnistCompatDataset.
/// Expectation: get correct number of data.
/// Feature: QMnistTestDataset
/// Description: Test basic usage of QMnistDataset with all and compat dataset
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestQMnistCompatDataset) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestQMnistCompatDataset.";
@ -212,9 +212,9 @@ TEST_F(MindDataTestPipeline, TestQMnistCompatDataset) {
iter->Stop();
}
/// Feature: QMnistTrainDatasetWithPipeline.
/// Description: test usage of QMnistTrainDataset with pipeline.
/// Expectation: get correct number of data.
/// Feature: QMnistTestDataset
/// Description: Test usage of QMnistDataset with pipeline mode
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestQMnistDatasetWithPipeline) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestQMnistTrainDatasetWithPipeline.";
@ -270,9 +270,9 @@ TEST_F(MindDataTestPipeline, TestQMnistDatasetWithPipeline) {
iter->Stop();
}
/// Feature: QMnistIteratorOneColumn.
/// Description: test iterator of QMnistDataset with only the "image" column.
/// Expectation: get correct data.
/// Feature: QMnistTestDataset
/// Description: Test iterator of QMnistDataset with only the image column
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestQMnistIteratorOneColumn) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestQMnistIteratorOneColumn.";
// Create a QMnist Dataset
@ -312,9 +312,9 @@ TEST_F(MindDataTestPipeline, TestQMnistIteratorOneColumn) {
iter->Stop();
}
/// Feature: QMnistIteratorWrongColumn.
/// Description: test iterator of QMnistDataset with wrong column.
/// Expectation: get none piece of data.
/// Feature: QMnistTestDataset
/// Description: Test iterator of QMnistDataset with wrong column
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestQMnistIteratorWrongColumn) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestQMnistIteratorWrongColumn.";
// Create a QMnist Dataset
@ -328,9 +328,9 @@ TEST_F(MindDataTestPipeline, TestQMnistIteratorWrongColumn) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: GetQMnistDatasetSize.
/// Description: test usage of get the size of QMnistDataset.
/// Expectation: get correct number of data.
/// Feature: QMnistTestDataset
/// Description: Test QMnistDataset GetDatasetSize
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestGetQMnistDatasetSize) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestGetQMnistTrainDatasetSize.";
@ -342,9 +342,9 @@ TEST_F(MindDataTestPipeline, TestGetQMnistDatasetSize) {
EXPECT_EQ(ds->GetDatasetSize(), 10);
}
/// Feature: QMnistDatasetGetters.
/// Description: test usage of getters QMnistTrainDataset.
/// Expectation: get correct number of data and correct tensor shape.
/// Feature: QMnistTestDataset
/// Description: Test QMnistDataset Getters method
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestQMnistDatasetGetters) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestQMnistTrainDatasetGetters.";
@ -383,9 +383,9 @@ TEST_F(MindDataTestPipeline, TestQMnistDatasetGetters) {
EXPECT_EQ(ds->GetDatasetSize(), 10);
}
/// Feature: QMnistDataFail.
/// Description: test failure of QMnistDataset.
/// Expectation: get none piece of data.
/// Feature: QMnistTestDataset
/// Description: Test QMnistDataset with invalid folder path input
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestQMnistDataFail) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestQMnistDataFail.";
@ -399,9 +399,9 @@ TEST_F(MindDataTestPipeline, TestQMnistDataFail) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: QMnistDataWithInvalidUsageFail.
/// Description: test failure of QMnistDataset with invalid usage.
/// Expectation: get none piece of data.
/// Feature: QMnistTestDataset
/// Description: Test QMnistDataset with invalid usage
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestQMnistDataWithInvalidUsageFail) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestQMnistDataWithInvalidUsageFail.";
@ -416,9 +416,9 @@ TEST_F(MindDataTestPipeline, TestQMnistDataWithInvalidUsageFail) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: QMnistDataWithNullSamplerFail.
/// Description: test failure of QMnistDataset with null sampler.
/// Expectation: get none piece of data.
/// Feature: QMnistTestDataset
/// Description: Test QMnistDataset with null sampler
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestQMnistDataWithNullSamplerFail) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestQMnistDataWithNullSamplerFail.";

View File

@ -1,5 +1,5 @@
/**
* Copyright 2020-2021 Huawei Technologies Co., Ltd
* Copyright 2020-2022 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -25,6 +25,9 @@ class MindDataTestPipeline : public UT::DatasetOpTesting {
protected:
};
/// Feature: RandomDataDataset
/// Description: Test RandomDataDataset basic usage with default schema
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestRandomDatasetBasic1) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRandomDatasetBasic1.";
@ -69,6 +72,9 @@ TEST_F(MindDataTestPipeline, TestRandomDatasetBasic1) {
iter->Stop();
}
/// Feature: RandomDataDataset
/// Description: Test RandomDataDataset with pipeline mode
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestRandomDatasetBasicWithPipeline) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRandomDatasetBasicWithPipeline.";
@ -127,6 +133,9 @@ TEST_F(MindDataTestPipeline, TestRandomDatasetBasicWithPipeline) {
iter->Stop();
}
/// Feature: RandomDataDataset
/// Description: Test RandomDataDataset Getters method
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestRandomDatasetGetters) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRandomDatasetGetters.";
@ -180,6 +189,9 @@ TEST_F(MindDataTestPipeline, TestRandomDatasetBasic2) {
iter->Stop();
}
/// Feature: RandomDataDataset
/// Description: Test RandomDataDataset basic usage with SCHEMA_FILE as an input to Schema
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestRandomDatasetBasic3) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRandomDatasetBasic3.";
@ -263,6 +275,9 @@ TEST_F(MindDataTestPipeline, TestRandomDatasetBasic3) {
GlobalContext::config_manager()->set_seed(curr_seed);
}
/// Feature: RandomDataDataset
/// Description: Test RandomDataDataset basic usage using SCHEMA_FILE path as an input
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestRandomDatasetBasic4) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRandomDatasetBasic4.";
@ -345,6 +360,9 @@ TEST_F(MindDataTestPipeline, TestRandomDatasetBasic4) {
GlobalContext::config_manager()->set_seed(curr_seed);
}
/// Feature: RandomDataDataset
/// Description: Test RandomDataDataset basic usage with input columns
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestRandomDatasetBasic5) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRandomDatasetBasic5.";
@ -407,6 +425,9 @@ TEST_F(MindDataTestPipeline, TestRandomDatasetBasic5) {
GlobalContext::config_manager()->set_seed(curr_seed);
}
/// Feature: RandomDataDataset
/// Description: Test RandomDataDataset basic usage with null schema and input columns
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestRandomDatasetBasic6) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRandomDatasetBasic6.";
@ -441,6 +462,9 @@ TEST_F(MindDataTestPipeline, TestRandomDatasetBasic6) {
GlobalContext::config_manager()->set_seed(curr_seed);
}
/// Feature: RandomDataDataset
/// Description: Test RandomDataDataset basic usage with empty string schema and input columns
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestRandomDatasetBasic7) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRandomDatasetBasic7.";
@ -477,7 +501,7 @@ TEST_F(MindDataTestPipeline, TestRandomDatasetBasic7) {
// Feature: Test Repeat and Shuffle on RandomData
// Description: Apply operations, iterate through dataset and count rows
// Expectation: There should be 30 rows in the dataset
// Expectation: There should be 30 rows in the dataset
TEST_F(MindDataTestPipeline, TestRandomDatasetBasic8) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRandomDatasetBasic8.";
@ -522,6 +546,9 @@ TEST_F(MindDataTestPipeline, TestRandomDatasetBasic8) {
GlobalContext::config_manager()->set_seed(curr_seed);
}
/// Feature: RandomDataDataset
/// Description: Test RandomDataDataset with UInt8 numbers for given shape
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestRandomDatasetUInt8) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRandomDatasetUInt8.";
@ -560,6 +587,9 @@ TEST_F(MindDataTestPipeline, TestRandomDatasetUInt8) {
GlobalContext::config_manager()->set_seed(curr_seed);
}
/// Feature: RandomDataDataset
/// Description: Test RandomDataDataset with float numbers for given shape
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestRandomDatasetFloat) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRandomDatasetFloat.";
@ -598,6 +628,9 @@ TEST_F(MindDataTestPipeline, TestRandomDatasetFloat) {
GlobalContext::config_manager()->set_seed(curr_seed);
}
/// Feature: RandomDataDataset
/// Description: Test RandomDataDataset with duplicate column names
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestRandomDatasetDuplicateColumnName) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRandomDatasetDuplicateColumnName.";
@ -610,6 +643,9 @@ TEST_F(MindDataTestPipeline, TestRandomDatasetDuplicateColumnName) {
EXPECT_EQ(ds->CreateIterator(), nullptr);
}
/// Feature: RandomDataDataset
/// Description: Test RandomDataDataset with num_workers greater than num_rows
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestRandomDatasetFail) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRandomDatasetFail.";
// this will fail because num_workers is greater than num_rows

View File

@ -1,5 +1,5 @@
/**
* Copyright 2020-2021 Huawei Technologies Co., Ltd
* Copyright 2020-2022 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -24,6 +24,9 @@ class MindDataTestPipeline : public UT::DatasetOpTesting {
protected:
};
/// Feature: Save
/// Description: Test Save on function with loading Cifar10Dataset
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestSaveCifar10AndLoad) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSaveCifar10AndLoad(single mindrecord file).";
@ -117,6 +120,9 @@ TEST_F(MindDataTestPipeline, TestSaveCifar10AndLoad) {
EXPECT_EQ(remove(temp_file_db.c_str()), 0);
}
/// Feature: Save
/// Description: Test Save on Cifar10Datasetwith invalid inputs
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestSaveFail) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSaveFail with incorrect param.";

View File

@ -1,5 +1,5 @@
/**
* Copyright 2021 Huawei Technologies Co., Ltd
* Copyright 2021-2022 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -26,9 +26,9 @@ class MindDataTestPipeline : public UT::DatasetOpTesting {
protected:
};
/// Feature: SBUDataset.
/// Description: test basic usage of SBUDataset.
/// Expectation: get correct number of data.
/// Feature: SBUDataset
/// Description: Test basic usage of SBUDataset
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestSBUDataset) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSBUDataset.";
@ -63,9 +63,9 @@ TEST_F(MindDataTestPipeline, TestSBUDataset) {
iter->Stop();
}
/// Feature: SBUDatasetWithPipeline.
/// Description: test usage of SBUDataset with pipeline.
/// Expectation: get correct number of data.
/// Feature: SBUDataset
/// Description: Test SBUDataset with pipeline mode
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestSBUDatasetWithPipeline) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSBUDatasetWithPipeline.";
@ -121,9 +121,9 @@ TEST_F(MindDataTestPipeline, TestSBUDatasetWithPipeline) {
iter->Stop();
}
/// Feature: SBUIteratorOneColumn.
/// Description: test iterator of SBUDataset with only the "image" column.
/// Expectation: get correct data.
/// Feature: SBUDataset
/// Description: Test iterator of SBUDataset with only the image column
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestSBUIteratorOneColumn) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSBUIteratorOneColumn.";
// Create a SBU Dataset
@ -161,9 +161,9 @@ TEST_F(MindDataTestPipeline, TestSBUIteratorOneColumn) {
iter->Stop();
}
/// Feature: SBUIteratorWrongColumn.
/// Description: test iterator of SBUtDataset with wrong column.
/// Expectation: get none piece of data.
/// Feature: SBUDataset
/// Description: Test iterator of SBUDataset with wrong column
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestSBUIteratorWrongColumn) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSBUIteratorWrongColumn.";
// Create a SBU Dataset
@ -177,9 +177,9 @@ TEST_F(MindDataTestPipeline, TestSBUIteratorWrongColumn) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: SBUDatasetSize.
/// Description: test usage of get the size of SBUDataset.
/// Expectation: get correct number of data.
/// Feature: SBUDataset
/// Description: Test SBUDataset GetDatasetSize
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestGetSBUDatasetSize) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestGetSBUDatasetSize.";
@ -191,9 +191,9 @@ TEST_F(MindDataTestPipeline, TestGetSBUDatasetSize) {
EXPECT_EQ(ds->GetDatasetSize(), 5);
}
/// Feature: SBUDatasetGetters.
/// Description: test usage of getters SBUDataset.
/// Expectation: get correct number of data and correct tensor shape.
/// Feature: SBUDataset
/// Description: Test SBUDataset Getters method
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestSBUDatasetGetters) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSBUDatasetGetters.";
@ -228,9 +228,9 @@ TEST_F(MindDataTestPipeline, TestSBUDatasetGetters) {
EXPECT_EQ(ds->GetDatasetSize(), 5);
}
/// Feature: SBUDataFail.
/// Description: test failure of SBUDataset.
/// Expectation: get none piece of data.
/// Feature: SBUDataset
/// Description: Test SBUDataset with invalid folder path input
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestSBUDatasetFail) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSBUDatasetFail.";
@ -244,9 +244,9 @@ TEST_F(MindDataTestPipeline, TestSBUDatasetFail) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: SBUDataWithNullSamplerFail.
/// Description: test failure of SBUDataset with null sampler.
/// Expectation: get none piece of data.
/// Feature: SBUDataset
/// Description: Test SBUDataset with null sampler
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestSBUDatasetWithNullSamplerFail) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSBUDatasetWithNullSamplerFail.";

View File

@ -1,5 +1,5 @@
/**
* Copyright 2021 Huawei Technologies Co., Ltd
* Copyright 2021-2022 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -26,9 +26,9 @@ class MindDataTestPipeline : public UT::DatasetOpTesting {
protected:
};
/// Feature: SemeionDataset.
/// Description: read some samples from all files.
/// Expectation: 10 samples.
/// Feature: SemeionDataset
/// Description: Test SemeionDataset basic usage
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestSemeionDataset) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSemeionDataset.";
@ -62,9 +62,9 @@ TEST_F(MindDataTestPipeline, TestSemeionDataset) {
iter->Stop();
}
/// Feature: SemeionDataset.
/// Description: read some samples with pipeline from all files.
/// Expectation: 10 samples.
/// Feature: SemeionDataset
/// Description: Test SemeionDataset with pipeline mode
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestSemeionDatasetWithPipeline) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSemeionDatasetWithPipeline.";
@ -119,9 +119,9 @@ TEST_F(MindDataTestPipeline, TestSemeionDatasetWithPipeline) {
iter->Stop();
}
/// Feature: SemeionIteratorOneColumn.
/// Description: test iterator of SemeionDataset with only the "image" column.
/// Expectation: get correct data.
/// Feature: SemeionDataset
/// Description: Test iterator of SemeionDataset with only the image column
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestSemeionIteratorOneColumn) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSemeionIteratorOneColumn.";
// Create a Semeion Dataset.
@ -161,9 +161,9 @@ TEST_F(MindDataTestPipeline, TestSemeionIteratorOneColumn) {
iter->Stop();
}
/// Feature: SemeionIteratorWrongColumn.
/// Description: test iterator of SemeionDataset with wrong column.
/// Expectation: get none piece of data.
/// Feature: SemeionDataset
/// Description: Test iterator of SemeionDataset with wrong column
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestSemeionIteratorWrongColumn) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSemeionIteratorWrongColumn.";
// Create a Semeion Dataset.
@ -177,9 +177,9 @@ TEST_F(MindDataTestPipeline, TestSemeionIteratorWrongColumn) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: SemeionDataset.
/// Description: read number of all samples from all files according to different versions.
/// Expectation: 10.
/// Feature: SemeionDataset
/// Description: Read number of all samples from all files according to different versions
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestSemeionGetDatasetSize) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSemeionGetDatasetSize.";
@ -191,9 +191,9 @@ TEST_F(MindDataTestPipeline, TestSemeionGetDatasetSize) {
EXPECT_EQ(ds->GetDatasetSize(), 10);
}
/// Feature: Data Property Testing.
/// Description: Includes tests for shape, type, size.
/// Expectation: correct shape, type, size.
/// Feature: SemeionDataset
/// Description: Test SemeionDataset Getters method
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestSemeionGetters) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSemeionGetters.";
@ -232,9 +232,9 @@ TEST_F(MindDataTestPipeline, TestSemeionGetters) {
EXPECT_EQ(ds->GetDatasetSize(), 10);
}
/// Feature: SemeionDataset.
/// Description: test with invalid path.
/// Expectation: unable to read in data.
/// Feature: SemeionDataset
/// Description: Test SemeionDataset with invalid folder path
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestSemeionDatasetFail) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSemeionDatasetFail.";
@ -250,9 +250,9 @@ TEST_F(MindDataTestPipeline, TestSemeionDatasetFail) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: SemeionDataset.
/// Description: test with null sampler.
/// Expectation: unable to read in data.
/// Feature: SemeionDataset
/// Description: Test SemeionDataset with null sampler
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestSemeionDatasetWithNullSamplerFail) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSemeionDatasetWithNullSamplerFail.";

View File

@ -1,5 +1,5 @@
/**
* Copyright 2021 Huawei Technologies Co., Ltd
* Copyright 2021-2022 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -25,8 +25,8 @@ protected:
};
/// Feature: Test SogouNews Dataset.
/// Description: read SogouNewsDataset data and get data.
/// Expectation: the data is processed successfully.
/// Description: Read SogouNewsDataset data and get data.
/// Expectation: The data is processed successfully.
TEST_F(MindDataTestPipeline, TestSogouNewsDatasetBasic) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSogouNewsDatasetBasic.";
@ -78,8 +78,8 @@ TEST_F(MindDataTestPipeline, TestSogouNewsDatasetBasic) {
}
/// Feature: Test SogouNews Dataset(usage=all).
/// Description: read train data and test data.
/// Expectation: the data is processed successfully.
/// Description: Read train data and test data.
/// Expectation: The data is processed successfully.
TEST_F(MindDataTestPipeline, TestSogouNewsDatasetUsageAll) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSogouNewsDatasetUsageAll.";
@ -141,8 +141,8 @@ TEST_F(MindDataTestPipeline, TestSogouNewsDatasetUsageAll) {
}
/// Feature: Test Getters.
/// Description: includes tests for shape, type, size.
/// Expectation: the data is processed successfully.
/// Description: Includes tests for shape, type, size.
/// Expectation: The data is processed successfully.
TEST_F(MindDataTestPipeline, TestSogouNewsGetters) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSogouNewsGetters.";
@ -156,8 +156,8 @@ TEST_F(MindDataTestPipeline, TestSogouNewsGetters) {
}
/// Feature: Test SogouNews Dataset(num_samples = 3).
/// Description: test whether the interface meets expectations when NumSamples is equal to 3.
/// Expectation: the data is processed successfully.
/// Description: Test whether the interface meets expectations when NumSamples is equal to 3.
/// Expectation: The data is processed successfully.
TEST_F(MindDataTestPipeline, TestSogouNewsNumSamples) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSogouNewsNumSamples.";
@ -209,8 +209,8 @@ TEST_F(MindDataTestPipeline, TestSogouNewsNumSamples) {
}
/// Feature: Test SogouNewsDataset in distribution.
/// Description: test interface in a distributed state.
/// Expectation: the data is processed successfully.
/// Description: Test interface in a distributed state.
/// Expectation: The data is processed successfully.
TEST_F(MindDataTestPipeline, TestSogouNewsDatasetDistribution) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSogouNewsDatasetDistribution.";
@ -262,8 +262,8 @@ TEST_F(MindDataTestPipeline, TestSogouNewsDatasetDistribution) {
}
/// Feature: Error Test.
/// Description: test the wrong input.
/// Expectation: unable to read in data.
/// Description: Test the wrong input.
/// Expectation: Unable to read in data.
TEST_F(MindDataTestPipeline, TestSogouNewsDatasetFail) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSogouNewsDatasetFail.";
@ -313,8 +313,8 @@ TEST_F(MindDataTestPipeline, TestSogouNewsDatasetFail) {
}
/// Feature: Test SogouNews Dataset(ShuffleMode=kFiles).
/// Description: test SogouNews Dataset interface with different ShuffleMode.
/// Expectation: the data is processed successfully.
/// Description: Test SogouNews Dataset interface with different ShuffleMode.
/// Expectation: The data is processed successfully.
TEST_F(MindDataTestPipeline, TestSogouNewsDatasetShuffleFilesA) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSogouNewsDatasetShuffleFilesA.";
@ -386,8 +386,8 @@ TEST_F(MindDataTestPipeline, TestSogouNewsDatasetShuffleFilesA) {
}
/// Feature: Test SogouNews Dataset(ShuffleMode=kInfile).
/// Description: test SogouNews Dataset interface with different ShuffleMode.
/// Expectation: the data is processed successfully.
/// Description: Test SogouNews Dataset interface with different ShuffleMode.
/// Expectation: The data is processed successfully.
TEST_F(MindDataTestPipeline, TestSogouNewsDatasetShuffleFilesB) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSogouNewsDatasetShuffleFilesB.";
@ -459,8 +459,8 @@ TEST_F(MindDataTestPipeline, TestSogouNewsDatasetShuffleFilesB) {
}
/// Feature: Test SogouNews Dataset(ShuffleMode=kGlobal).
/// Description: test SogouNews Dataset interface with different ShuffleMode.
/// Expectation: the data is processed successfully.
/// Description: Test SogouNews Dataset interface with different ShuffleMode.
/// Expectation: The data is processed successfully.
TEST_F(MindDataTestPipeline, TestSogouNewsDatasetShuffleFilesGlobal) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSogouNewsDatasetShuffleFilesGlobal.";

View File

@ -1,5 +1,5 @@
/**
* Copyright 2021 Huawei Technologies Co., Ltd
* Copyright 2021-2022 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -26,8 +26,8 @@ class MindDataTestPipeline : public UT::DatasetOpTesting {
};
/// Feature: Test SpeechCommands dataset.
/// Description: read data from a single file.
/// Expectation: the data is processed successfully.
/// Description: Read data from a single file.
/// Expectation: The data is processed successfully.
TEST_F(MindDataTestPipeline, TestSpeechCommandsDataset) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSpeechCommandsDataset.";
std::string folder_path = datasets_root_path_ + "/testSpeechCommandsData/";
@ -65,8 +65,8 @@ TEST_F(MindDataTestPipeline, TestSpeechCommandsDataset) {
}
/// Feature: Test SpeechCommands dataset.
/// Description: test SpeechCommands dataset in pipeline.
/// Expectation: the data is processed successfully.
/// Description: Test SpeechCommands dataset in pipeline.
/// Expectation: The data is processed successfully.
TEST_F(MindDataTestPipeline, TestSpeechCommandsDatasetWithPipeline) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSpeechCommandsDatasetWithPipeline.";
@ -126,8 +126,8 @@ TEST_F(MindDataTestPipeline, TestSpeechCommandsDatasetWithPipeline) {
}
/// Feature: TestSpeechCommandsDatasetIteratorOneColumn.
/// Description: test iterator of SpeechCommands dataset with only the "waveform" column.
/// Expectation: get correct data.
/// Description: Test iterator of SpeechCommands dataset with only the "waveform" column.
/// Expectation: Get correct data.
TEST_F(MindDataTestPipeline, TestSpeechCommandsDatasetIteratorOneColumn) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSpeechCommandsDatasetIteratorOneColumn.";
// Create a SpeechCommands dataset
@ -168,8 +168,8 @@ TEST_F(MindDataTestPipeline, TestSpeechCommandsDatasetIteratorOneColumn) {
}
/// Feature: TestSpeechCommandsDatasetIteratorWrongColumn.
/// Description: test iterator of SpeechCommandsDataset with wrong column.
/// Expectation: get none piece of data.
/// Description: Test iterator of SpeechCommandsDataset with wrong column.
/// Expectation: Error message is logged, and CreateIterator for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestSpeechCommandsDatasetIteratorWrongColumn) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSpeechCommandsDatasetIteratorWrongColumn.";
// Create a SpeechCommands dataset
@ -184,8 +184,8 @@ TEST_F(MindDataTestPipeline, TestSpeechCommandsDatasetIteratorWrongColumn) {
}
/// Feature: Test SpeechCommands dataset.
/// Description: get the size of SpeechCommands dataset.
/// Expectation: the data is processed successfully.
/// Description: Get the size of SpeechCommands dataset.
/// Expectation: The data is processed successfully.
TEST_F(MindDataTestPipeline, TestSpeechCommandsGetDatasetSize) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSpeechCommandsGetDatasetSize.";
@ -198,8 +198,8 @@ TEST_F(MindDataTestPipeline, TestSpeechCommandsGetDatasetSize) {
}
/// Feature: Test SpeechCommands dataset.
/// Description: getter functions.
/// Expectation: the data is processed successfully.
/// Description: Getter functions.
/// Expectation: The data is processed successfully.
TEST_F(MindDataTestPipeline, TestSpeechCommandsGetters) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSpeechCommandsMixGetter.";
// Create a SpeechCommands Dataset.
@ -234,8 +234,8 @@ TEST_F(MindDataTestPipeline, TestSpeechCommandsGetters) {
}
/// Feature: Test SpeechCommands dataset.
/// Description: test usage "train".
/// Expectation: the data is processed successfully.
/// Description: Test usage "train".
/// Expectation: The data is processed successfully.
TEST_F(MindDataTestPipeline, TestSpeechCommandsUsageTrain) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSpeechCommandsDataset.";
std::string folder_path = datasets_root_path_ + "/testSpeechCommandsData/";
@ -273,8 +273,8 @@ TEST_F(MindDataTestPipeline, TestSpeechCommandsUsageTrain) {
}
/// Feature: Test SpeechCommands dataset.
/// Description: test usage "test".
/// Expectation: the data is processed successfully.
/// Description: Test usage "test".
/// Expectation: The data is processed successfully.
TEST_F(MindDataTestPipeline, TestSpeechCommandsUsageTest) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSpeechCommandsDataset.";
std::string folder_path = datasets_root_path_ + "/testSpeechCommandsData/";
@ -312,8 +312,8 @@ TEST_F(MindDataTestPipeline, TestSpeechCommandsUsageTest) {
}
/// Feature: Test SpeechCommands dataset.
/// Description: test usage "valid".
/// Expectation: the data is processed successfully.
/// Description: Test usage "valid".
/// Expectation: The data is processed successfully.
TEST_F(MindDataTestPipeline, TestSpeechCommandsUsageValid) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSpeechCommandsDataset.";
std::string folder_path = datasets_root_path_ + "/testSpeechCommandsData/";
@ -351,8 +351,8 @@ TEST_F(MindDataTestPipeline, TestSpeechCommandsUsageValid) {
}
/// Feature: Test SpeechCommands dataset.
/// Description: error tests.
/// Expectation: throw error messages when certain errors occur.
/// Description: Test invalid folder path.
/// Expectation: Throw error messages when certain errors occur.
TEST_F(MindDataTestPipeline, TestSpeechCommandsDatasetFail) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSpeechCommandsDatasetFail.";
@ -367,8 +367,8 @@ TEST_F(MindDataTestPipeline, TestSpeechCommandsDatasetFail) {
}
/// Feature: Test SpeechCommands dataset.
/// Description: test error usages.
/// Expectation: throw error messages when certain errors occur.
/// Description: Test error usages.
/// Expectation: Throw error messages when certain errors occur.
TEST_F(MindDataTestPipeline, TestSpeechCommandsDatasetWithInvalidUsageFail) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSpeechCommandsDatasetFail.";
@ -384,8 +384,8 @@ TEST_F(MindDataTestPipeline, TestSpeechCommandsDatasetWithInvalidUsageFail) {
}
/// Feature: Test SpeechCommands dataset.
/// Description: test null sample error.
/// Expectation: throw error messages when certain errors occur.
/// Description: Test null sample error.
/// Expectation: Throw error messages when certain errors occur.
TEST_F(MindDataTestPipeline, TestSpeechCommandsDatasetWithNullSamplerFail) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSpeechCommandsDatasetWithNullSamplerFail.";

View File

@ -27,8 +27,8 @@ class MindDataTestPipeline : public UT::DatasetOpTesting {
};
/// Feature: SQuADDataset.
/// Description: test SQuADDataset basic.
/// Expectation: the data is processed successfully.
/// Description: Test SQuADDataset basic.
/// Expectation: The data is processed successfully.
TEST_F(MindDataTestPipeline, TestSQuADDatasetBasic) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSQuADDatasetBasic.";
@ -62,8 +62,8 @@ TEST_F(MindDataTestPipeline, TestSQuADDatasetBasic) {
}
/// Feature: SQuADDataset.
/// Description: test SQuADDataset in pipeline mode.
/// Expectation: the data is processed successfully.
/// Description: Test SQuADDataset in pipeline mode.
/// Expectation: The data is processed successfully.
TEST_F(MindDataTestPipeline, TestSQuADDatasetBasicWithPipeline) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSQuADDatasetBasicWithPipeline.";
@ -119,8 +119,8 @@ TEST_F(MindDataTestPipeline, TestSQuADDatasetBasicWithPipeline) {
}
/// Feature: SQuADDataset.
/// Description: test the getter functions of SQuADDataset.
/// Expectation: the data is processed successfully.
/// Description: Test the getter functions of SQuADDataset.
/// Expectation: The data is processed successfully.
TEST_F(MindDataTestPipeline, TestSQuADGetters) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSQuADGetters.";
@ -136,8 +136,8 @@ TEST_F(MindDataTestPipeline, TestSQuADGetters) {
}
/// Feature: SQuADDataset.
/// Description: test SQuAD1.1 for train, dev and all.
/// Expectation: the data is processed successfully.
/// Description: Test SQuAD1.1 for train, dev and all.
/// Expectation: The data is processed successfully.
TEST_F(MindDataTestPipeline, TestSQuADDatasetVersion1) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSQuADDatasetVersion1.";
@ -243,8 +243,8 @@ TEST_F(MindDataTestPipeline, TestSQuADDatasetVersion1) {
}
/// Feature: SQuADDataset.
/// Description: test SQuAD2.0 for train, dev and all.
/// Expectation: the data is processed successfully.
/// Description: Test SQuAD2.0 for train, dev and all.
/// Expectation: The data is processed successfully.
TEST_F(MindDataTestPipeline, TestSQuADDatasetVersion2) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSQuADDatasetVersion2.";
@ -349,8 +349,8 @@ TEST_F(MindDataTestPipeline, TestSQuADDatasetVersion2) {
}
/// Feature: SQuADDataset.
/// Description: test the distribution of SQuADDataset.
/// Expectation: the data is processed successfully.
/// Description: Test the distribution of SQuADDataset.
/// Expectation: The data is processed successfully.
TEST_F(MindDataTestPipeline, TestSQuADDatasetDistribution) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSQuADDatasetDistribution.";
@ -385,8 +385,8 @@ TEST_F(MindDataTestPipeline, TestSQuADDatasetDistribution) {
}
/// Feature: SQuADDataset.
/// Description: test some failed cases of SQuADDataset.
/// Expectation: throw correct error and message.
/// Description: Test some failed cases of SQuADDataset.
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr.
TEST_F(MindDataTestPipeline, TestSQuADDatasetFail) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSQuADDatasetFail.";
// Create a SQuAD Dataset
@ -438,8 +438,8 @@ TEST_F(MindDataTestPipeline, TestSQuADDatasetFail) {
}
/// Feature: SQuADDataset.
/// Description: test the Shuffle of SQuADDataset.
/// Expectation: the data is processed successfully.
/// Description: Test the Shuffle of SQuADDataset.
/// Expectation: The data is processed successfully.
TEST_F(MindDataTestPipeline, TestSQuADDatasetShuffleFilesA) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSQuADDatasetShuffleFilesA.";
// Test SQuAD Dataset with files shuffle, num_parallel_workers=1.
@ -504,8 +504,8 @@ TEST_F(MindDataTestPipeline, TestSQuADDatasetShuffleFilesA) {
}
/// Feature: SQuADDataset.
/// Description: test the Shuffle of SQuADDataset.
/// Expectation: the data is processed successfully.
/// Description: Test the Shuffle of SQuADDataset.
/// Expectation: The data is processed successfully.
TEST_F(MindDataTestPipeline, TestSQuADDatasetShuffleFilesB) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSQuADDatasetShuffleFilesB.";
// Test SQuAD Dataset with files shuffle, num_parallel_workers=1.
@ -570,8 +570,8 @@ TEST_F(MindDataTestPipeline, TestSQuADDatasetShuffleFilesB) {
}
/// Feature: SQuADDataset.
/// Description: test the global Shuffle of SQuADDataset.
/// Expectation: the data is processed successfully.
/// Description: Test the global Shuffle of SQuADDataset.
/// Expectation: The data is processed successfully.
TEST_F(MindDataTestPipeline, TestSQuADDatasetShuffleGlobal) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSQuADDatasetShuffleGlobal.";
// Test SQuAD Dataset with GLOBLE shuffle

View File

@ -1,5 +1,5 @@
/**
* Copyright 2021 Huawei Technologies Co., Ltd
* Copyright 2021-2022 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -26,9 +26,9 @@ class MindDataTestPipeline : public UT::DatasetOpTesting {
protected:
};
/// Feature: STL10TrainDataset.
/// Description: test basic usage of STL10TrainDataset.
/// Expectation: get correct number of data.
/// Feature: STL10Dataset
/// Description: Test basic usage of STL10Dataset with train dataset
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestSTL10TrainDataset) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSTL10TrainDataset.";
@ -63,9 +63,9 @@ TEST_F(MindDataTestPipeline, TestSTL10TrainDataset) {
iter->Stop();
}
/// Feature: STL10TestDataset.
/// Description: test basic usage of STL10TestDataset.
/// Expectation: get correct number of data.
/// Feature: STL10Dataset
/// Description: Test basic usage of STL10Dataset with test dataset
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestSTL10TestDataset) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSTL10TestDataset.";
@ -100,9 +100,9 @@ TEST_F(MindDataTestPipeline, TestSTL10TestDataset) {
iter->Stop();
}
/// Feature: STL10UnlabeledDataset.
/// Description: test basic usage of STL10UnlabeledDataset.
/// Expectation: get correct number of data.
/// Feature: STL10Dataset
/// Description: Test basic usage of STL10Dataset with unlabeled dataset
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestSTL10UnlabeledDataset) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSTL10UnlabeledDataset.";
@ -137,9 +137,9 @@ TEST_F(MindDataTestPipeline, TestSTL10UnlabeledDataset) {
iter->Stop();
}
/// Feature: STL10TrainUnlabeledDataset.
/// Description: test basic usage of STL10TrainUnlabeledDataset.
/// Expectation: get correct number of data.
/// Feature: STL10Dataset
/// Description: Test basic usage of STL10Dataset with train+unlabeled dataset
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestSTL10TrainUnlabeledDataset) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSTL10TrainUnlabeledDataset.";
@ -174,9 +174,9 @@ TEST_F(MindDataTestPipeline, TestSTL10TrainUnlabeledDataset) {
iter->Stop();
}
/// Feature: STL10AllDataset.
/// Description: test basic usage of STL10AllDataset.
/// Expectation: get correct number of data.
/// Feature: STL10Dataset
/// Description: Test basic usage of STL10Dataset with all dataset
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestSTL10AllDataset) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSTL10AllDataset.";
@ -211,9 +211,9 @@ TEST_F(MindDataTestPipeline, TestSTL10AllDataset) {
iter->Stop();
}
/// Feature: STL10TrainDatasetWithPipeline.
/// Description: test usage of STL10TrainDataset with pipeline.
/// Expectation: get correct number of data.
/// Feature: STL10Dataset
/// Description: Test usage of STL10Dataset with pipeline mode
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestSTL10TrainDatasetWithPipeline) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSTL10TrainDatasetWithPipeline.";
@ -269,9 +269,9 @@ TEST_F(MindDataTestPipeline, TestSTL10TrainDatasetWithPipeline) {
iter->Stop();
}
/// Feature: TestSTL10DatasetIteratorOneColumn.
/// Description: test iterator of STL10Dataset with only the "image" column.
/// Expectation: get correct data.
/// Feature: STL10Dataset
/// Description: Test iterator of STL10Dataset with only the image column
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestSTL10DatasetIteratorOneColumn) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSTL10DatasetIteratorOneColumn.";
// Create a STL10 Dataset
@ -311,9 +311,9 @@ TEST_F(MindDataTestPipeline, TestSTL10DatasetIteratorOneColumn) {
iter->Stop();
}
/// Feature: TestSTL10DatasetIteratorWrongColumn.
/// Description: test iterator of STL10Dataset with wrong column.
/// Expectation: get none piece of data.
/// Feature: STL10Dataset
/// Description: Test iterator of STL10Dataset with wrong column
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestSTL10DatasetIteratorWrongColumn) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSTL10DatasetIteratorWrongColumn.";
// Create a STL10 Dataset
@ -327,9 +327,9 @@ TEST_F(MindDataTestPipeline, TestSTL10DatasetIteratorWrongColumn) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: STL10GetTrainDatasetSize.
/// Description: test usage of STL10GetTrainDatasetSize with pipeline.
/// Expectation: get correct number of data.
/// Feature: STL10Dataset
/// Description: Test usage of STL10Dataset with train dataset GetDatasetSize
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestSTL10GetTrainDatasetSize) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSTL10GetTrainDatasetSize.";
@ -341,9 +341,9 @@ TEST_F(MindDataTestPipeline, TestSTL10GetTrainDatasetSize) {
EXPECT_EQ(ds->GetDatasetSize(), 1);
}
/// Feature: STL10GetTestDatasetSize.
/// Description: test usage of STL10GetTestDatasetSize with pipeline.
/// Expectation: get correct number of data.
/// Feature: STL10Dataset
/// Description: Test STL10Dataset with test dataset GetDatasetSize
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestSTL10GetTestDatasetSize) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSTL10GetTestDatasetSize.";
@ -355,9 +355,9 @@ TEST_F(MindDataTestPipeline, TestSTL10GetTestDatasetSize) {
EXPECT_EQ(ds->GetDatasetSize(), 1);
}
/// Feature: STL10GetUnlabeledDatasetSize.
/// Description: test usage of STL10GetUnlabeledDatasetSize with pipeline.
/// Expectation: get correct number of data.
/// Feature: STL10Dataset
/// Description: Test STL10Dataset with unlabeled dataset GetDatasetSize
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestSTL10GetUnlabeledDatasetSize) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSTL10GetUnlabeledDatasetSize.";
@ -369,9 +369,9 @@ TEST_F(MindDataTestPipeline, TestSTL10GetUnlabeledDatasetSize) {
EXPECT_EQ(ds->GetDatasetSize(), 1);
}
/// Feature: STL10GetTrainUnlabeledDatasetSize.
/// Description: test usage of STL10GetTrainUnlabeledDatasetSize with pipeline.
/// Expectation: get correct number of data.
/// Feature: STL10Dataset
/// Description: Test STL10Dataset with train+unlabeled dataset GetDatasetSize
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestSTL10GetTrainUnlabeledDatasetSize) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSTL10GetTrainUnlabeledDatasetSize.";
@ -383,9 +383,9 @@ TEST_F(MindDataTestPipeline, TestSTL10GetTrainUnlabeledDatasetSize) {
EXPECT_EQ(ds->GetDatasetSize(), 2);
}
/// Feature: STL10GetAllDatasetSize.
/// Description: test usage of STL10GetAllDatasetSize with pipeline.
/// Expectation: get correct number of data.
/// Feature: STL10Dataset
/// Description: Test STL10Dataset with all dataset GetDatasetSize
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestSTL10GetAllDatasetSize) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSTL10GetAllDatasetSize.";
@ -397,9 +397,9 @@ TEST_F(MindDataTestPipeline, TestSTL10GetAllDatasetSize) {
EXPECT_EQ(ds->GetDatasetSize(), 3);
}
/// Feature: STL10TrainDatasetGetters.
/// Description: test usage of getters STL10TrainDataset.
/// Expectation: get correct number of data and correct tensor shape.
/// Feature: STL10Dataset
/// Description: Test STL10Dataset Getters method
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestSTL10TrainGetters) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSTL10TrainGetter.";
@ -438,9 +438,9 @@ TEST_F(MindDataTestPipeline, TestSTL10TrainGetters) {
EXPECT_EQ(ds->GetDatasetSize(), 1);
}
/// Feature: STL10DatasetFail.
/// Description: test failure of STL10Dataset.
/// Expectation: get none piece of data.
/// Feature: STL10Dataset
/// Description: Test STL10Dataset with invalid folder path input
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, testSTL10DataFail) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-testSTL10DataFail.";
@ -454,9 +454,9 @@ TEST_F(MindDataTestPipeline, testSTL10DataFail) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: STL10DatasetWithInvalidUsageFail.
/// Description: test failure of STL10Dataset with invalid usage.
/// Expectation: get none piece of data.
/// Feature: STL10Dataset
/// Description: Test STL10Dataset with invalid usage
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, testSTL10DataWithInvalidUsageFail) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-testSTL10DataWithNullSamplerFail.";
@ -471,9 +471,9 @@ TEST_F(MindDataTestPipeline, testSTL10DataWithInvalidUsageFail) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: STL10DatasetWithNullSamplerFail.
/// Description: test failure of STL10Dataset with null sampler.
/// Expectation: get none piece of data.
/// Feature: STL10Dataset
/// Description: Test STL10Dataset with null sampler
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, testSTL10DataWithNullSamplerFail) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-testSTL10DataWithNullSamplerFail.";

View File

@ -1,5 +1,5 @@
/**
* Copyright 2021 Huawei Technologies Co., Ltd
* Copyright 2021-2022 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -27,7 +27,7 @@ class MindDataTestPipeline : public UT::DatasetOpTesting {
};
/// Feature: TedliumDataset.
/// Description: read some samples from all files according to different versions.
/// Description: Read some samples from all files according to different versions.
/// Expectation: 4 * 2 samples.
TEST_F(MindDataTestPipeline, TestTedliumDataset) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestTedliumDataset.";
@ -93,7 +93,7 @@ TEST_F(MindDataTestPipeline, TestTedliumDataset) {
}
/// Feature: TedliumDataset.
/// Description: read some samples with pipeline from all files according to different versions.
/// Description: Read some samples with pipeline from all files according to different versions.
/// Expectation: 8 * 2 samples.
TEST_F(MindDataTestPipeline, TestTedliumDatasetWithPipeline) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestTedliumDatasetWithPipeline.";
@ -193,9 +193,9 @@ TEST_F(MindDataTestPipeline, TestTedliumDatasetWithPipeline) {
iter3->Stop();
}
/// Feature: TestTedliumDatasetIteratorOneColumn.
/// Description: test iterator of Tedlium dataset with only the "waveform" column.
/// Expectation: get correct data.
/// Feature: TedliumDataset.
/// Description: Test iterator of Tedlium dataset with only the "waveform" column.
/// Expectation: Get correct data.
TEST_F(MindDataTestPipeline, TestTedliumDatasetIteratorOneColumn) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestTedliumDatasetIteratorOneColumn.";
// Create a Tedlium Dataset.
@ -233,9 +233,9 @@ TEST_F(MindDataTestPipeline, TestTedliumDatasetIteratorOneColumn) {
iter->Stop();
}
/// Feature: TestTedliumDatasetIteratorWrongColumn.
/// Description: test iterator of TedliumDataset with wrong column.
/// Expectation: get none piece of data.
/// Feature: TedliumDataset.
/// Description: Test iterator of TedliumDataset with wrong column.
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr.
TEST_F(MindDataTestPipeline, TestTedliumDatasetIteratorWrongColumn) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestTedliumDatasetIteratorWrongColumn.";
// Create a Tedlium Dataset.
@ -251,7 +251,7 @@ TEST_F(MindDataTestPipeline, TestTedliumDatasetIteratorWrongColumn) {
}
/// Feature: TedliumDataset.
/// Description: read number of all samples from all files according to different versions.
/// Description: Read number of all samples from all files according to different versions.
/// Expectation: TEDLIUM_release12 : 1 + 2 + 3
/// TEDLIUM_release3 : 3 + 4
TEST_F(MindDataTestPipeline, TestTedliumGetDatasetSize) {
@ -270,8 +270,8 @@ TEST_F(MindDataTestPipeline, TestTedliumGetDatasetSize) {
}
/// Feature: TedliumDataset.
/// Description: Includes tests for shape, type, size.
/// Expectation: correct shape, type, size.
/// Description: Test TedliumDataset Getters method.
/// Expectation: Correct shape, type, size.
TEST_F(MindDataTestPipeline, TestTedliumGetters) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestTedliumGetters.";
@ -320,8 +320,8 @@ TEST_F(MindDataTestPipeline, TestTedliumGetters) {
}
/// Feature: TedliumDataset.
/// Description: test with invalid release.
/// Expectation: unable to read in data.
/// Description: Test with invalid release.
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr.
TEST_F(MindDataTestPipeline, TestTedliumDatasetWithInvalidReleaseFail) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestTedliumDatasetWithInvalidReleaseFail.";
@ -346,8 +346,8 @@ TEST_F(MindDataTestPipeline, TestTedliumDatasetWithInvalidReleaseFail) {
}
/// Feature: TedliumDataset.
/// Description: test with invalid path.
/// Expectation: unable to read in data.
/// Description: Test with invalid path.
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr.
TEST_F(MindDataTestPipeline, TestTedliumDatasetFail) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestTedliumDatasetFail.";
@ -371,8 +371,8 @@ TEST_F(MindDataTestPipeline, TestTedliumDatasetFail) {
}
/// Feature: TedliumDataset.
/// Description: test with invalid usage.
/// Expectation: unable to read in data.
/// Description: Test with invalid usage.
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr.
TEST_F(MindDataTestPipeline, TestTedliumDatasetWithInvalidUsageFail) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestTedliumDatasetWithInvalidUsageFail.";
@ -397,8 +397,8 @@ TEST_F(MindDataTestPipeline, TestTedliumDatasetWithInvalidUsageFail) {
}
/// Feature: TedliumDataset.
/// Description: test with invalid extensions.
/// Expectation: unable to read in data.
/// Description: Test with invalid extensions.
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr.
TEST_F(MindDataTestPipeline, TestTedliumDatasetWithInvalidExtensionsFail) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestTedliumDatasetWithInvalidExtensionsFail.";
@ -423,8 +423,8 @@ TEST_F(MindDataTestPipeline, TestTedliumDatasetWithInvalidExtensionsFail) {
}
/// Feature: TedliumDataset.
/// Description: test with null sampler.
/// Expectation: unable to read in data.
/// Description: Test with null sampler.
/// Expectation: Unable to read in data.
TEST_F(MindDataTestPipeline, TestTedliumDatasetWithNullSamplerFail) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestTedliumDatasetWithNullSamplerFail.";

View File

@ -1,5 +1,5 @@
/**
* Copyright 2020-2021 Huawei Technologies Co., Ltd
* Copyright 2020-2022 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -25,6 +25,9 @@ class MindDataTestPipeline : public UT::DatasetOpTesting {
protected:
};
/// Feature: TextFileDataset
/// Description: Test TextFileDataset basic usage
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestTextFileDatasetBasic) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestTextFileDatasetBasic.";
// Test TextFile Dataset with single text file and many default inputs
@ -84,6 +87,9 @@ TEST_F(MindDataTestPipeline, TestTextFileDatasetBasic) {
GlobalContext::config_manager()->set_num_parallel_workers(original_num_parallel_workers);
}
/// Feature: TextFileDataset
/// Description: Test TextFileDataset basic usage with pipeline mode
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestTextFileDatasetBasicWithPipeline) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestTextFileDatasetBasicWithPipeline.";
// Test TextFile Dataset with single text file and many default inputs
@ -148,6 +154,9 @@ TEST_F(MindDataTestPipeline, TestTextFileDatasetBasicWithPipeline) {
GlobalContext::config_manager()->set_num_parallel_workers(original_num_parallel_workers);
}
/// Feature: TextFileDataset
/// Description: Test TextFileDataset Getters method
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestTextFileGetters) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestTextFileGetters.";
// Test TextFile Dataset with single text file and many default inputs
@ -180,6 +189,9 @@ TEST_F(MindDataTestPipeline, TestTextFileGetters) {
GlobalContext::config_manager()->set_num_parallel_workers(original_num_parallel_workers);
}
/// Feature: TextFileDataset
/// Description: Test TextFileDataset with invalid samplers=-1
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestTextFileDatasetFail1) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestTextFileDatasetFail1.";
@ -195,6 +207,9 @@ TEST_F(MindDataTestPipeline, TestTextFileDatasetFail1) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: TextFileDataset
/// Description: Test TextFileDataset with empty dataset_files input
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestTextFileDatasetFail2) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestTextFileDatasetFail2.";
@ -209,6 +224,9 @@ TEST_F(MindDataTestPipeline, TestTextFileDatasetFail2) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: TextFileDataset
/// Description: Test TextFileDataset with non-existent dataset_files input
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestTextFileDatasetFail3) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestTextFileDatasetFail3.";
@ -224,6 +242,9 @@ TEST_F(MindDataTestPipeline, TestTextFileDatasetFail3) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: TextFileDataset
/// Description: Test TextFileDataset with empty string dataset_files input
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestTextFileDatasetFail4) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestTextFileDatasetFail4.";
@ -238,6 +259,9 @@ TEST_F(MindDataTestPipeline, TestTextFileDatasetFail4) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: TextFileDataset
/// Description: Test TextFileDataset with invalid num_shards=0
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestTextFileDatasetFail5) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestTextFileDatasetFail5.";
@ -253,6 +277,9 @@ TEST_F(MindDataTestPipeline, TestTextFileDatasetFail5) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: TextFileDataset
/// Description: Test TextFileDataset with invalid shard_id=-1
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestTextFileDatasetFail6) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestTextFileDatasetFail6.";
@ -268,6 +295,9 @@ TEST_F(MindDataTestPipeline, TestTextFileDatasetFail6) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: TextFileDataset
/// Description: Test TextFileDataset with invalid shard_id=2 and num_shards=2 combination
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestTextFileDatasetFail7) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestTextFileDatasetFail7.";
@ -283,7 +313,7 @@ TEST_F(MindDataTestPipeline, TestTextFileDatasetFail7) {
EXPECT_EQ(iter, nullptr);
}
// Feature: Test Textfile dataset
// Feature: TextFileDataset
// Description: Create TextFile dataset with a file that does not exist and check the size of the dataset
// Expectation: The dataset should have size 0
TEST_F(MindDataTestPipeline, TestTextFileFileNotExist) {
@ -298,6 +328,9 @@ TEST_F(MindDataTestPipeline, TestTextFileFileNotExist) {
EXPECT_EQ(ds->GetDatasetSize(), 0);
}
/// Feature: TextFileDataset
/// Description: Test with ShuffleMode::kFalse with two text files, 1.txt then 2.txt, in lexicographical order
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestTextFileDatasetShuffleFalse1A) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestTextFileDatasetShuffleFalse1A.";
// Test TextFile Dataset with two text files and no shuffle, num_parallel_workers=1
@ -359,6 +392,9 @@ TEST_F(MindDataTestPipeline, TestTextFileDatasetShuffleFalse1A) {
GlobalContext::config_manager()->set_num_parallel_workers(original_num_parallel_workers);
}
/// Feature: TextFileDataset
/// Description: Test with ShuffleMode::kFalse with two text files, 2.txt then 1.txt, in non-lexicographical order
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestTextFileDatasetShuffleFalse1B) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestTextFileDatasetShuffleFalse1B.";
// Test TextFile Dataset with two text files and no shuffle, num_parallel_workers=1
@ -420,6 +456,9 @@ TEST_F(MindDataTestPipeline, TestTextFileDatasetShuffleFalse1B) {
GlobalContext::config_manager()->set_num_parallel_workers(original_num_parallel_workers);
}
/// Feature: TextFileDataset
/// Description: Test TextFileDataset with ShuffleMode::kFalse with shard coverage
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestTextFileDatasetShuffleFalse4Shard) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestTextFileDatasetShuffleFalse4Shard.";
// Test TextFile Dataset with two text files and no shuffle, num_parallel_workers=4, shard coverage
@ -480,6 +519,9 @@ TEST_F(MindDataTestPipeline, TestTextFileDatasetShuffleFalse4Shard) {
GlobalContext::config_manager()->set_num_parallel_workers(original_num_parallel_workers);
}
/// Feature: TextFileDataset
/// Description: Test with ShuffleMode::kFiles with two text files, 1.txt then 2.txt, in lexicographical order
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestTextFileDatasetShuffleFiles1A) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestTextFileDatasetShuffleFiles1A.";
// Test TextFile Dataset with files shuffle, num_parallel_workers=1
@ -543,6 +585,9 @@ TEST_F(MindDataTestPipeline, TestTextFileDatasetShuffleFiles1A) {
GlobalContext::config_manager()->set_num_parallel_workers(original_num_parallel_workers);
}
/// Feature: TextFileDataset
/// Description: Test with ShuffleMode::kFiles with two text files, 2.txt then 1.txt, in non-lexicographical order
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestTextFileDatasetShuffleFiles1B) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestTextFileDatasetShuffleFiles1B.";
// Test TextFile Dataset with files shuffle, num_parallel_workers=1
@ -606,6 +651,9 @@ TEST_F(MindDataTestPipeline, TestTextFileDatasetShuffleFiles1B) {
GlobalContext::config_manager()->set_num_parallel_workers(original_num_parallel_workers);
}
/// Feature: TextFileDataset
/// Description: Test TextFileDataset with ShuffleMode::kFiles with num_parallel_workers=4
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestTextFileDatasetShuffleFiles4) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestTextFileDatasetShuffleFiles4.";
// Test TextFile Dataset with files shuffle, num_parallel_workers=4
@ -668,6 +716,9 @@ TEST_F(MindDataTestPipeline, TestTextFileDatasetShuffleFiles4) {
GlobalContext::config_manager()->set_num_parallel_workers(original_num_parallel_workers);
}
/// Feature: TextFileDataset
/// Description: Test TextFileDataset with ShuffleMode::kGlobal with 1 text file
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestTextFileDatasetShuffleGlobal1A) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestTextFileDatasetShuffleGlobal1A.";
// Test TextFile Dataset with 1 text file, global shuffle, num_parallel_workers=1
@ -726,6 +777,9 @@ TEST_F(MindDataTestPipeline, TestTextFileDatasetShuffleGlobal1A) {
GlobalContext::config_manager()->set_num_parallel_workers(original_num_parallel_workers);
}
/// Feature: TextFileDataset
/// Description: Test TextFileDataset with ShuffleMode::kGlobal with 2 text files
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestTextFileDatasetShuffleGlobal1B) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestTextFileDatasetShuffleGlobal1B.";
// Test TextFile Dataset with 2 text files, global shuffle, num_parallel_workers=1
@ -787,6 +841,9 @@ TEST_F(MindDataTestPipeline, TestTextFileDatasetShuffleGlobal1B) {
GlobalContext::config_manager()->set_num_parallel_workers(original_num_parallel_workers);
}
/// Feature: TextFileDataset
/// Description: Test TextFileDataset with ShuffleMode::kGlobal with num_parallel_workers=4
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestTextFileDatasetShuffleGlobal4) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestTextFileDatasetShuffleGlobal4.";
// Test TextFile Dataset with 2 text files, global shuffle, num_parallel_workers=4

View File

@ -1,5 +1,5 @@
/**
* Copyright 2020-2021 Huawei Technologies Co., Ltd
* Copyright 2020-2022 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -28,6 +28,9 @@ class MindDataTestPipeline : public UT::DatasetOpTesting {
protected:
};
/// Feature: TFRecordDataset
/// Description: Test TFRecordDataset basic usage
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestTFRecordDatasetBasic) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestTFRecordDatasetBasic.";
@ -84,6 +87,9 @@ TEST_F(MindDataTestPipeline, TestTFRecordDatasetBasic) {
iter->Stop();
}
/// Feature: TFRecordDataset
/// Description: Test TFRecordDataset Getters method
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestTFRecordDatasetBasicGetters) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestTFRecordDatasetBasicGetters.";
@ -116,6 +122,9 @@ TEST_F(MindDataTestPipeline, TestTFRecordDatasetBasicGetters) {
EXPECT_EQ(ds->GetColumnNames(), column_names);
}
/// Feature: TFRecordDataset
/// Description: Test TFRecordDataset with ShuffleMode::kFalse
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestTFRecordDatasetShuffle) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestTFRecordDatasetShuffle.";
// This case is to verify if the list of datafiles are sorted in lexicographical order.
@ -176,6 +185,9 @@ TEST_F(MindDataTestPipeline, TestTFRecordDatasetShuffle) {
GlobalContext::config_manager()->set_num_parallel_workers(original_num_parallel_workers);
}
/// Feature: TFRecordDataset
/// Description: Test TFRecordDataset with ShuffleMode::kGlobal
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestTFRecordDatasetShuffle2) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestTFRecordDatasetShuffle2.";
// This case is to verify the content of the data is indeed shuffled.
@ -224,6 +236,9 @@ TEST_F(MindDataTestPipeline, TestTFRecordDatasetShuffle2) {
GlobalContext::config_manager()->set_num_parallel_workers(original_num_parallel_workers);
}
/// Feature: TFRecordDataset
/// Description: Test TFRecordDataset with schema using file path
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestTFRecordDatasetSchemaPath) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestTFRecordDatasetSchemaPath.";
@ -266,6 +281,9 @@ TEST_F(MindDataTestPipeline, TestTFRecordDatasetSchemaPath) {
iter->Stop();
}
/// Feature: TFRecordDataset
/// Description: Test TFRecordDataset with schema using SchemaObj
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestTFRecordDatasetSchemaObj) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestTFRecordDatasetSchemaObj.";
@ -327,6 +345,9 @@ TEST_F(MindDataTestPipeline, TestTFRecordDatasetSchemaObj) {
iter->Stop();
}
/// Feature: TFRecordDataset
/// Description: Test TFRecordDataset without schema (nullptr)
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestTFRecordDatasetNoSchema) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestTFRecordDatasetNoSchema.";
@ -367,6 +388,9 @@ TEST_F(MindDataTestPipeline, TestTFRecordDatasetNoSchema) {
iter->Stop();
}
/// Feature: TFRecordDataset
/// Description: Test TFRecordDataset with column names as input
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestTFRecordDatasetColName) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestTFRecordDatasetColName.";
@ -401,6 +425,9 @@ TEST_F(MindDataTestPipeline, TestTFRecordDatasetColName) {
iter->Stop();
}
/// Feature: TFRecordDataset
/// Description: Test TFRecordDataset with num_shards and shard_id
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestTFRecordDatasetShard) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestTFRecordDatasetShard.";
@ -446,6 +473,9 @@ TEST_F(MindDataTestPipeline, TestTFRecordDatasetShard) {
iter2->Stop();
}
/// Feature: TFRecordDataset
/// Description: Test TFRecordDataset with invalid inputs
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestTFRecordDatasetExeception) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestTFRecordDatasetExeception.";
@ -481,6 +511,9 @@ TEST_F(MindDataTestPipeline, TestTFRecordDatasetExeception) {
EXPECT_EQ(ds8->CreateIterator(), nullptr);
}
/// Feature: TFRecordDataset
/// Description: Test TFRecordDataset with column name that does not exist in the dataset
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestTFRecordDatasetExeception2) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestTFRecordDatasetExeception2.";
// This case expected to fail because the input column name does not exist.
@ -498,6 +531,9 @@ TEST_F(MindDataTestPipeline, TestTFRecordDatasetExeception2) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: TFRecordDataset
/// Description: Test TFRecordDataset with invalid schema used
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestIncorrectTFSchemaObject) {
std::string path = datasets_root_path_ + "/test_tf_file_3_images2/train-0000-of-0001.data";
std::shared_ptr<SchemaObj> schema = Schema();
@ -512,6 +548,9 @@ TEST_F(MindDataTestPipeline, TestIncorrectTFSchemaObject) {
EXPECT_ERROR(itr->GetNextRow(&mp));
}
/// Feature: TFRecordDataset
/// Description: Test TFRecordDataset with invalid TFRecord file
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestIncorrectTFrecordFile) {
std::string path = datasets_root_path_ + "/test_tf_file_3_images2/datasetSchema.json";
std::shared_ptr<Dataset> ds = TFRecord({path});
@ -523,7 +562,7 @@ TEST_F(MindDataTestPipeline, TestIncorrectTFrecordFile) {
// Feature: Test TFRecord with a schema file
// Description: Create TFRecord with datasetSchema1Row.json
// Expectation: There should be 1 row in the dataset
// Expectation: There should be 1 row in the dataset
TEST_F(MindDataTestPipeline, TestTFRecordDatasetBasic1Row) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestTFRecordDatasetBasic.";
@ -556,7 +595,7 @@ TEST_F(MindDataTestPipeline, TestTFRecordDatasetBasic1Row) {
// Feature: Test TFRecord with a schema file
// Description: Create TFRecord with datasetSchema7Rows.json
// Expectation: There should be 7 rows in the dataset
// Expectation: There should be 7 rows in the dataset
TEST_F(MindDataTestPipeline, TestTFRecordDatasetBasic7Row) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestTFRecordDatasetBasic.";

View File

@ -1,5 +1,5 @@
/**
* Copyright 2021 Huawei Technologies Co., Ltd
* Copyright 2021-2022 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -26,8 +26,8 @@ class MindDataTestPipeline : public UT::DatasetOpTesting {
};
/// Feature: Test UDPOS Dataset.
/// Description: read data from a single file.
/// Expectation: three data in one file.
/// Description: Read data from a single file.
/// Expectation: Three data in one file.
TEST_F(MindDataTestPipeline, TestUDPOSDatasetBasic) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestUDPOSDatasetBasic.";
// Test UDPOS Dataset with single UDPOS file and many default inputs.
@ -84,8 +84,8 @@ TEST_F(MindDataTestPipeline, TestUDPOSDatasetBasic) {
}
/// Feature: Test UDPOS Dataset.
/// Description: repeat read data.
/// Expectation: five times the read-in data.
/// Description: Repeat read data.
/// Expectation: Five times the read-in data.
TEST_F(MindDataTestPipeline, TestUDPOSDatasetBasicWithPipeline) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestUDPOSDatasetBasicWithPipeline.";
// Test UDPOS Dataset with single UDPOS file and many default inputs.
@ -152,7 +152,7 @@ TEST_F(MindDataTestPipeline, TestUDPOSDatasetBasicWithPipeline) {
/// Feature: Test UDPOS Dataset.
/// Description: Includes tests for shape, type, size.
/// Expectation: correct shape, type, size.
/// Expectation: Correct shape, type, size.
TEST_F(MindDataTestPipeline, TestUDPOSGetters) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestUDPOSGetters.";
// Test UDPOS Dataset with single UDPOS file and many default inputs.
@ -195,8 +195,8 @@ TEST_F(MindDataTestPipeline, TestUDPOSGetters) {
}
/// Feature: Test UDPOS Dataset.
/// Description: test with samplers=-1.
/// Expectation: unable to read in data.
/// Description: Test with samplers=-1.
/// Expectation: Unable to read in data.
TEST_F(MindDataTestPipeline, TestUDPOSDatasetInvalidSamplers) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestUDPOSDatasetInvalidSamplers.";
@ -213,8 +213,8 @@ TEST_F(MindDataTestPipeline, TestUDPOSDatasetInvalidSamplers) {
}
/// Feature: Test UDPOS Dataset.
/// Description: test with wrongful empty dataset_files.
/// Expectation: unable to read in data.
/// Description: Test with wrongful empty dataset_files.
/// Expectation: Unable to read in data.
TEST_F(MindDataTestPipeline, TestUDPOSDatasetInvalidFilePath) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestUDPOSDatasetInvalidFilePath.";
@ -230,8 +230,8 @@ TEST_F(MindDataTestPipeline, TestUDPOSDatasetInvalidFilePath) {
}
/// Feature: Test UDPOS Dataset.
/// Description: test with non-existent dataset_files.
/// Expectation: unable to read in data.
/// Description: Test with non-existent dataset_files.
/// Expectation: Unable to read in data.
TEST_F(MindDataTestPipeline, TestUDPOSDatasetInvalidFileName) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestUDPOSDatasetInvalidFileName.";
@ -248,8 +248,8 @@ TEST_F(MindDataTestPipeline, TestUDPOSDatasetInvalidFileName) {
}
/// Feature: Test UDPOS Dataset.
/// Description: test with empty string dataset_files.
/// Expectation: unable to read in data.
/// Description: Test with empty string dataset_files.
/// Expectation: Unable to read in data.
TEST_F(MindDataTestPipeline, TestUDPOSDatasetEmptyFilePath) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestUDPOSDatasetEmptyFilePath.";
@ -265,8 +265,8 @@ TEST_F(MindDataTestPipeline, TestUDPOSDatasetEmptyFilePath) {
}
/// Feature: Test UDPOS Dataset.
/// Description: test with invalid num_shards=0 value.
/// Expectation: unable to read in data.
/// Description: Test with invalid num_shards=0 value.
/// Expectation: Unable to read in data.
TEST_F(MindDataTestPipeline, TestUDPOSDatasetInvalidNumShards) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestUDPOSDatasetInvalidNumShards.";
@ -283,8 +283,8 @@ TEST_F(MindDataTestPipeline, TestUDPOSDatasetInvalidNumShards) {
}
/// Feature: Test UDPOS Dataset.
/// Description: test with invalid shard_id=-1 value.
/// Expectation: unable to read in data.
/// Description: Test with invalid shard_id=-1 value.
/// Expectation: Unable to read in data.
TEST_F(MindDataTestPipeline, TestUDPOSDatasetInvalidShardId) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestUDPOSDatasetInvalidShardId.";
@ -301,8 +301,8 @@ TEST_F(MindDataTestPipeline, TestUDPOSDatasetInvalidShardId) {
}
/// Feature: Test UDPOS Dataset.
/// Description: test with invalid shard_id=2 and num_shards=2 combination.
/// Expectation: unable to read in data.
/// Description: Test with invalid shard_id=2 and num_shards=2 combination.
/// Expectation: Unable to read in data.
TEST_F(MindDataTestPipeline, TestUDPOSDatasetInvalidIdAndShards) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestUDPOSDatasetInvalidIdAndShards.";
@ -319,8 +319,8 @@ TEST_F(MindDataTestPipeline, TestUDPOSDatasetInvalidIdAndShards) {
}
/// Feature: Test UDPOS Dataset.
/// Description: read all data with no shuffle, num_parallel_workers=1.
/// Expectation: return correct data.
/// Description: Read all data with no shuffle, num_parallel_workers=1.
/// Expectation: Return correct data.
TEST_F(MindDataTestPipeline, TestUDPOSDatasetShuffleFalse) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestUDPOSDatasetShuffleFalse.";
// Test UDPOS Dataset with three UDPOS files and no shuffle, num_parallel_workers=1.
@ -384,8 +384,8 @@ TEST_F(MindDataTestPipeline, TestUDPOSDatasetShuffleFalse) {
}
/// Feature: Test UDPOS Dataset.
/// Description: read all data with files shuffle, num_parallel_workers=1.
/// Expectation: return correct data.
/// Description: Read all data with files shuffle, num_parallel_workers=1.
/// Expectation: Return correct data.
TEST_F(MindDataTestPipeline, TestUDPOSDatasetShuffleFilesA) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestUDPOSDatasetShuffleFilesA.";
// Test TUDPOS Dataset with files shuffle, num_parallel_workers=1.
@ -449,8 +449,8 @@ TEST_F(MindDataTestPipeline, TestUDPOSDatasetShuffleFilesA) {
}
/// Feature: Test UDPOS Dataset.
/// Description: read all data with no shuffle, num_parallel_workers=4, shard coverage.
/// Expectation: return correct data.
/// Description: Read all data with no shuffle, num_parallel_workers=4, shard coverage.
/// Expectation: Return correct data.
TEST_F(MindDataTestPipeline, TestUDPOSDatasetShuffleFilesB) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestUDPOSDatasetShuffleFilesB.";
// Test UDPOS Dataset with files shuffle, num_parallel_workers=1.
@ -514,8 +514,8 @@ TEST_F(MindDataTestPipeline, TestUDPOSDatasetShuffleFilesB) {
}
/// Feature: Test UDPOS Dataset.
/// Description: read all data with global shuffle, num_parallel_workers=1.
/// Expectation: return correct data.
/// Description: Read all data with global shuffle, num_parallel_workers=1.
/// Expectation: Return correct data.
TEST_F(MindDataTestPipeline, TestUDPOSDatasetShuffleGlobal) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestUDPOSDatasetShuffleGlobal.";
// Test UDPOS Dataset with one UDPOS file, global shuffle, num_parallel_workers=1.

View File

@ -1,5 +1,5 @@
/**
* Copyright 2021 Huawei Technologies Co., Ltd
* Copyright 2021-2022 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -25,9 +25,9 @@ class MindDataTestPipeline : public UT::DatasetOpTesting {
protected:
};
/// Feature: USPSTrainDataset.
/// Description: test basic usage of USPSTrainDataset.
/// Expectation: get correct number of data.
/// Feature: USPSDataset
/// Description: Test basic usage of USPSDataset with train dataset
/// Expectation: Get correct number of data
TEST_F(MindDataTestPipeline, TestUSPSTrainDataset) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestUSPSTrainDataset.";
@ -62,9 +62,9 @@ TEST_F(MindDataTestPipeline, TestUSPSTrainDataset) {
iter->Stop();
}
/// Feature: USPSTestDataset.
/// Description: test basic usage of USPSTestDataset.
/// Expectation: get correct number of data.
/// Feature: USPSDataset
/// Description: Test basic usage of USPSDataset with test dataset
/// Expectation: Get correct number of data
TEST_F(MindDataTestPipeline, TestUSPSTestDataset) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestUSPSTestDataset.";
@ -99,9 +99,9 @@ TEST_F(MindDataTestPipeline, TestUSPSTestDataset) {
iter->Stop();
}
/// Feature: USPSAllDataset.
/// Description: test basic usage of USPSAllDataset.
/// Expectation: get correct number of data.
/// Feature: USPSDataset
/// Description: Test basic usage of USPSDataset with all dataset
/// Expectation: Get correct number of data
TEST_F(MindDataTestPipeline, TestUSPSAllDataset) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestUSPSAllDataset.";
@ -136,9 +136,9 @@ TEST_F(MindDataTestPipeline, TestUSPSAllDataset) {
iter->Stop();
}
/// Feature: USPSDatasetWithPipeline.
/// Description: test usage of USPSDataset with pipeline.
/// Expectation: get correct number of data.
/// Feature: USPSDataset
/// Description: Test usage of USPSDataset with pipeline mode
/// Expectation: Get correct number of data
TEST_F(MindDataTestPipeline, TestUSPSDatasetWithPipeline) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestUSPSTrainDatasetWithPipeline.";
@ -194,9 +194,9 @@ TEST_F(MindDataTestPipeline, TestUSPSDatasetWithPipeline) {
iter->Stop();
}
/// Feature: USPSIteratorOneColumn.
/// Description: test iterator of USPSDataset with only the "image" column.
/// Expectation: get correct data.
/// Feature: USPSDataset
/// Description: Test iterator of USPSDataset with only the "image" column
/// Expectation: Get correct data
TEST_F(MindDataTestPipeline, TestUSPSIteratorOneColumn) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestUSPSIteratorOneColumn.";
// Create a USPS Dataset
@ -236,9 +236,9 @@ TEST_F(MindDataTestPipeline, TestUSPSIteratorOneColumn) {
iter->Stop();
}
/// Feature: USPSIteratorWrongColumn.
/// Description: test iterator of USPSDataset with wrong column.
/// Expectation: get none piece of data.
/// Feature: USPSDataset
/// Description: Test iterator of USPSDataset with wrong column
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestUSPSIteratorWrongColumn) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestUSPSIteratorWrongColumn.";
// Create a USPS Dataset
@ -252,9 +252,9 @@ TEST_F(MindDataTestPipeline, TestUSPSIteratorWrongColumn) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: GetUSPSDatasetSize.
/// Description: test usage of get the size of USPSDataset.
/// Expectation: get correct number of data.
/// Feature: USPSDataset
/// Description: Test GetDatasetSize of USPSDataset
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestGetUSPSDatasetSize) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestGetUSPSTrainDatasetSize.";
@ -266,9 +266,9 @@ TEST_F(MindDataTestPipeline, TestGetUSPSDatasetSize) {
EXPECT_EQ(ds->GetDatasetSize(), 3);
}
/// Feature: USPSDatasetGetters.
/// Description: test usage of getters USPSDataset.
/// Expectation: get correct number of data and correct tensor shape.
/// Feature: USPSDataset
/// Description: Test usage of getters USPSDataset
/// Expectation: Get correct number of data and correct tensor shape
TEST_F(MindDataTestPipeline, TestUSPSDatasetGetters) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestUSPSTrainDatasetGetters.";
@ -303,9 +303,9 @@ TEST_F(MindDataTestPipeline, TestUSPSDatasetGetters) {
EXPECT_EQ(ds->GetDatasetSize(), 3);
}
/// Feature: USPSDataFail.
/// Description: test failure of USPSDataset.
/// Expectation: get none piece of data.
/// Feature: USPSDataset
/// Description: Test failure of USPSDataset with empty string as folder path
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestUSPSDatasetFail) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestUSPSDatasetFail.";
@ -319,9 +319,9 @@ TEST_F(MindDataTestPipeline, TestUSPSDatasetFail) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: USPSDatasetWithInvalidUsageFail.
/// Description: test failure of USPSDataset with invalid usage.
/// Expectation: get none piece of data.
/// Feature: USPSDataset
/// Description: Test failure of USPSDataset with invalid usage
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestUSPSDatasetWithInvalidUsageFail) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestUSPSDatasetWithInvalidUsageFail.";

View File

@ -1,5 +1,5 @@
/**
* Copyright 2020-2021 Huawei Technologies Co., Ltd
* Copyright 2020-2022 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -26,6 +26,9 @@ class MindDataTestPipeline : public UT::DatasetOpTesting {
protected:
};
/// Feature: VOCDataset
/// Description: Test VOCDataset with class_index
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestVOCClassIndex) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestVOCClassIndex.";
@ -75,6 +78,9 @@ TEST_F(MindDataTestPipeline, TestVOCClassIndex) {
iter->Stop();
}
/// Feature: VOCDataset
/// Description: Test VOCDataset GetClassIndexing
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestVOCGetClassIndex) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestVOCGetClassIndex.";
// Create a VOC Dataset
@ -97,6 +103,9 @@ TEST_F(MindDataTestPipeline, TestVOCGetClassIndex) {
EXPECT_EQ(class_index1[2].second[0], 9);
}
/// Feature: VOCDataset
/// Description: Test VOCDataset Getters method
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestVOCGetters) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestVOCGetters.";
@ -118,6 +127,9 @@ TEST_F(MindDataTestPipeline, TestVOCGetters) {
EXPECT_EQ(ds->GetColumnNames(), column_names);
}
/// Feature: VOCDataset
/// Description: Test VOCDataset Detection task
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestVOCDetection) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestVOCDetection.";
@ -166,8 +178,8 @@ TEST_F(MindDataTestPipeline, TestVOCDetection) {
iter->Stop();
}
// Feature: Test VOC dataset with detection task
// Description: Create VOC dataset with task="Detection" and count rows
// Feature: VOCDataset
// Description: Create VOCDataset with task="Detection" and count rows
// Expectation: There should be 9 rows
TEST_F(MindDataTestPipeline, TestVOCDetection1) {
std::string dataset_path;
@ -192,6 +204,9 @@ TEST_F(MindDataTestPipeline, TestVOCDetection1) {
iter->Stop();
}
/// Feature: VOCDataset
/// Description: Test VOCDataset with invalid task or invalid mode
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestVOCInvalidTaskOrModeError1) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestVOCInvalidTaskOrModeError1.";
@ -214,6 +229,9 @@ TEST_F(MindDataTestPipeline, TestVOCInvalidTaskOrModeError1) {
EXPECT_EQ(iter2, nullptr);
}
/// Feature: VOCDataset
/// Description: Test VOCDataset Segmentation task
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestVOCSegmentation) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestVOCSegmentation.";
@ -261,8 +279,8 @@ TEST_F(MindDataTestPipeline, TestVOCSegmentation) {
iter->Stop();
}
// Feature: Test VOC dataset with Segmentation task
// Description: Create VOC dataset with take="Segmentation" and count rows
// Feature: VOCDataset
// Description: Create VOCDataset with take="Segmentation" and count rows
// Expectation: There should be 10 rows
TEST_F(MindDataTestPipeline, TestVOCSegmentation1) {
std::string dataset_path;
@ -287,6 +305,9 @@ TEST_F(MindDataTestPipeline, TestVOCSegmentation1) {
iter->Stop();
}
/// Feature: VOCDataset
/// Description: Test VOCDataset Segmentation task with invalid sampler input
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestVOCSegmentationError2) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestVOCSegmentationError2.";
@ -303,6 +324,9 @@ TEST_F(MindDataTestPipeline, TestVOCSegmentationError2) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: VOCDataset
/// Description: Test VOCDataset Segmentation task with null sampler
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestVOCWithNullSamplerError3) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestVOCWithNullSamplerError3.";

View File

@ -1,5 +1,5 @@
/**
* Copyright 2021 Huawei Technologies Co., Ltd
* Copyright 2021-2022 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -27,8 +27,8 @@ class MindDataTestPipeline : public UT::DatasetOpTesting {
};
/// Feature: Test WIDERFace dataset.
/// Description: read data for default usage.
/// Expectation: the data is processed successfully.
/// Description: Read data for default usage.
/// Expectation: The data is processed successfully.
TEST_F(MindDataTestPipeline, TestWIDERFace) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestWIDERFace.";
// Create a WIDERFace Dataset.
@ -78,8 +78,8 @@ TEST_F(MindDataTestPipeline, TestWIDERFace) {
}
/// Feature: Test WIDERFace dataset.
/// Description: test usage "test".
/// Expectation: the data is processed successfully.
/// Description: Test usage "test".
/// Expectation: The data is processed successfully.
TEST_F(MindDataTestPipeline, TestWIDERFaceTest) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestWIDERFaceTest.";
// Create a WIDERFace Dataset.
@ -106,8 +106,8 @@ TEST_F(MindDataTestPipeline, TestWIDERFaceTest) {
}
/// Feature: Test WIDERFace dataset.
/// Description: test pipeline.
/// Expectation: the data is processed successfully.
/// Description: Test pipeline.
/// Expectation: The data is processed successfully.
TEST_F(MindDataTestPipeline, TestWIDERFaceDefaultWithPipeline) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestWIDERFaceDefaultWithPipeline.";
// Create two WIDERFace Dataset.
@ -174,8 +174,8 @@ TEST_F(MindDataTestPipeline, TestWIDERFaceDefaultWithPipeline) {
}
/// Feature: Test WIDERFace dataset.
/// Description: test WIDERFace getters.
/// Expectation: the data is processed successfully.
/// Description: Test WIDERFace getters.
/// Expectation: The data is processed successfully.
TEST_F(MindDataTestPipeline, TestWIDERFaceGetters) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestWIDERFaceGetters.";
// Create a WIDERFace Dataset.
@ -191,8 +191,8 @@ TEST_F(MindDataTestPipeline, TestWIDERFaceGetters) {
}
/// Feature: Test WIDERFace dataset.
/// Description: test WIDERFace usage error.
/// Expectation: throw error messages when certain errors occur.
/// Description: Test WIDERFace usage error.
/// Expectation: Throw error messages when certain errors occur.
TEST_F(MindDataTestPipeline, TestWIDERFaceWithUsageError) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestWIDERFaceWithNullSamplerFail.";
// Create a WIDERFace Dataset.
@ -208,8 +208,8 @@ TEST_F(MindDataTestPipeline, TestWIDERFaceWithUsageError) {
}
/// Feature: Test WIDERFace dataset.
/// Description: test WIDERFace with SequentialSampler.
/// Expectation: the data is processed successfully.
/// Description: Test WIDERFace with SequentialSampler.
/// Expectation: The data is processed successfully.
TEST_F(MindDataTestPipeline, TestWIDERFaceSequentialSampler) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestWIDERFaceSequentialSampler.";
@ -242,8 +242,8 @@ TEST_F(MindDataTestPipeline, TestWIDERFaceSequentialSampler) {
}
/// Feature: Test WIDERFace dataset.
/// Description: test WIDERFace with invalid nullptr sampler.
/// Expectation: throw error messages when certain errors occur.
/// Description: Test WIDERFace with invalid nullptr sampler.
/// Expectation: Throw error messages when certain errors occur.
TEST_F(MindDataTestPipeline, TestWIDERFaceWithNullSamplerError) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestWIDERFaceWithNullSamplerError.";
@ -259,8 +259,8 @@ TEST_F(MindDataTestPipeline, TestWIDERFaceWithNullSamplerError) {
}
/// Feature: Test WIDERFace dataset.
/// Description: test WIDERFace error.
/// Expectation: throw error messages when certain errors occur.
/// Description: Test WIDERFace error.
/// Expectation: Throw error messages when certain errors occur.
TEST_F(MindDataTestPipeline, TestWIDERFaceError) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestWIDERFaceError.";

View File

@ -1,5 +1,5 @@
/**
* Copyright 2021 Huawei Technologies Co., Ltd
* Copyright 2021-2022 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -25,9 +25,9 @@ class MindDataTestPipeline : public UT::DatasetOpTesting {
protected:
};
/// Feature: Test WikiText Dataset.
/// Description: read WikiText data and get data.
/// Expectation: the data is processed successfully.
/// Feature: WikiTextDataset
/// Description: Test WikiTextDataset basic usage
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestWikiTextDatasetBasic) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestWikiTextDatasetBasic.";
// Test WikiText Dataset with single text file and many default inputs
@ -84,9 +84,9 @@ TEST_F(MindDataTestPipeline, TestWikiTextDatasetBasic) {
GlobalContext::config_manager()->set_num_parallel_workers(original_num_parallel_workers);
}
/// Feature: Test WikiText Dataset.
/// Description: read WikiText data and get data.
/// Expectation: the data is processed successfully.
/// Feature: WikiTextDataset
/// Description: Test WikiTextDataset in pipeline mode
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestWikiTextDatasetBasicWithPipeline) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestWikiTextDatasetBasicWithPipeline.";
// Test WikiText Dataset with single text file and many default inputs
@ -146,9 +146,9 @@ TEST_F(MindDataTestPipeline, TestWikiTextDatasetBasicWithPipeline) {
GlobalContext::config_manager()->set_num_parallel_workers(original_num_parallel_workers);
}
/// Feature: WikiTextIteratorOneColumn.
/// Description: test iterator of WikiTextDataset with only the "text" column.
/// Expectation: get correct data.
/// Feature: WikiTextDataset
/// Description: Test iterator of WikiTextDataset with only the "text" column
/// Expectation: Get correct data
TEST_F(MindDataTestPipeline, TestWikiTextIteratorOneColumn) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestWikiTextIteratorOneColumn.";
// Test WikiText Dataset with single text file and many default inputs
@ -196,9 +196,9 @@ TEST_F(MindDataTestPipeline, TestWikiTextIteratorOneColumn) {
iter->Stop();
}
/// Feature: WikiTextIteratorWrongColumn.
/// Description: test iterator of WikiTextDataset with wrong column.
/// Expectation: get none piece of data.
/// Feature: WikiTextDataset
/// Description: Test iterator of WikiTextDataset with wrong column
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestWikiTextIteratorWrongColumn) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestWikiTextIteratorWrongColumn.";
// Test WikiText Dataset with single text file and many default inputs
@ -220,9 +220,9 @@ TEST_F(MindDataTestPipeline, TestWikiTextIteratorWrongColumn) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: Test WikiText Dataset.
/// Description: read WikiText data and get data.
/// Expectation: the data is processed successfully.
/// Feature: WikiTextDataset
/// Description: Test WikiTextDataset Getters method
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestWikiTextGetters) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestWikiTextGetters.";
// Test WikiText Dataset with single text file and many default inputs
@ -258,9 +258,9 @@ TEST_F(MindDataTestPipeline, TestWikiTextGetters) {
GlobalContext::config_manager()->set_num_parallel_workers(original_num_parallel_workers);
}
/// Feature: Test WikiText Dataset.
/// Description: Testing abnormal inputs.
/// Expectation: Exception thrown to be caught.
/// Feature: WikiTextDataset
/// Description: Test WikiTextDataset with invalid samplers=-1
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestWikiTextDatasetFail1) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestWikiTextDatasetFail1.";
@ -276,9 +276,9 @@ TEST_F(MindDataTestPipeline, TestWikiTextDatasetFail1) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: Test WikiText Dataset.
/// Description: Testing abnormal inputs.
/// Expectation: Exception thrown to be caught.
/// Feature: WikiTextDataset
/// Description: Test WikiTextDataset with empty dataset_files input
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestWikiTextDatasetFail2) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestWikiTextDatasetFail2.";
@ -294,9 +294,9 @@ TEST_F(MindDataTestPipeline, TestWikiTextDatasetFail2) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: Test WikiText Dataset.
/// Description: Testing abnormal inputs.
/// Expectation: Exception thrown to be caught.
/// Feature: WikiTextDataset
/// Description: Test WikiTextDataset with non-existent dataset_files input
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestWikiTextDatasetFail3) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestWikiTextDatasetFail3.";
@ -312,9 +312,9 @@ TEST_F(MindDataTestPipeline, TestWikiTextDatasetFail3) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: Test WikiText Dataset.
/// Description: Testing abnormal inputs.
/// Expectation: Exception thrown to be caught.
/// Feature: WikiTextDataset
/// Description: Test WikiTextDataset with empty string dataset_files input
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestWikiTextDatasetFail4) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestWikiTextDatasetFail4.";
@ -330,9 +330,9 @@ TEST_F(MindDataTestPipeline, TestWikiTextDatasetFail4) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: Test WikiText Dataset.
/// Description: Testing abnormal inputs.
/// Expectation: Exception thrown to be caught.
/// Feature: WikiTextDataset
/// Description: Test WikiTextDataset with invalid num_shards=0
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestWikiTextDatasetFail5) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestWikiTextDatasetFail5.";
@ -348,9 +348,9 @@ TEST_F(MindDataTestPipeline, TestWikiTextDatasetFail5) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: Test WikiText Dataset.
/// Description: Testing abnormal inputs.
/// Expectation: Exception thrown to be caught.
/// Feature: WikiTextDataset
/// Description: Test WikiTextDataset with invalid shard_id=-1
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestWikiTextDatasetFail6) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestWikiTextDatasetFail6.";
@ -366,9 +366,9 @@ TEST_F(MindDataTestPipeline, TestWikiTextDatasetFail6) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: Test WikiText Dataset.
/// Description: Testing abnormal inputs.
/// Expectation: Exception thrown to be caught.
/// Feature: WikiTextDataset
/// Description: Test WikiTextDataset with invalid shard_id=2 and num_shards=2 combination
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestWikiTextDatasetFail7) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestWikiTextDatasetFail7.";
@ -384,9 +384,9 @@ TEST_F(MindDataTestPipeline, TestWikiTextDatasetFail7) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: Test WikiText Dataset.
/// Description: Test WikiTextDataset with Shuffle mode False.
/// Expectation: Exception thrown to be caught.
/// Feature: WikiTextDataset
/// Description: Test WikiTextDataset with ShuffleMode::kFalse
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestWikiTextDatasetShuffleFalse) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestWikiTextDatasetShuffleFalse.";
@ -451,9 +451,9 @@ TEST_F(MindDataTestPipeline, TestWikiTextDatasetShuffleFalse) {
GlobalContext::config_manager()->set_num_parallel_workers(original_num_parallel_workers);
}
/// Feature: Test WikiText Dataset.
/// Description: Test WikiTextDataset with Shuffle mode Files.
/// Expectation: the data is processed successfully.
/// Feature: WikiTextDataset
/// Description: Test WikiTextDataset with ShuffleMode::kFiles
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestWikiTextDatasetShuffleFilesA) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestWikiTextDatasetShuffleFilesA.";
@ -518,9 +518,9 @@ TEST_F(MindDataTestPipeline, TestWikiTextDatasetShuffleFilesA) {
GlobalContext::config_manager()->set_num_parallel_workers(original_num_parallel_workers);
}
/// Feature: Test WikiText Dataset.
/// Description: Test WikiTextDataset with Shuffle mode Infile.
/// Expectation: the data is processed successfully.
/// Feature: WikiTextDataset
/// Description: Test WikiTextDataset with ShuffleMode::kInfile
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestWikiTextDatasetShuffleFilesB) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestWikiTextDatasetShuffleFilesB.";
@ -585,9 +585,9 @@ TEST_F(MindDataTestPipeline, TestWikiTextDatasetShuffleFilesB) {
GlobalContext::config_manager()->set_num_parallel_workers(original_num_parallel_workers);
}
/// Feature: Test WikiText Dataset.
/// Description: Test WikiTextDataset with Shuffle mode Global.
/// Expectation: the data is processed successfully.
/// Feature: WikiTextDataset
/// Description: Test WikiTextDataset with ShuffleMode::kGlobal
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestWikiTextDatasetShuffleGlobal) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestWikiTextDatasetShuffleGlobal.";

View File

@ -1,5 +1,5 @@
/**
* Copyright 2021 Huawei Technologies Co., Ltd
* Copyright 2021-2022 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -24,8 +24,8 @@ class MindDataTestPipeline : public UT::DatasetOpTesting {
};
/// Feature: YahooAnswersDataset.
/// Description: read test data.
/// Expectation: the data is processed successfully.
/// Description: Read test data.
/// Expectation: The data is processed successfully.
TEST_F(MindDataTestPipeline, TestYahooAnswersDatasetBasic) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestYahooAnswersDatasetBasic.";
@ -70,8 +70,8 @@ TEST_F(MindDataTestPipeline, TestYahooAnswersDatasetBasic) {
}
/// Feature: YahooAnswersDataset.
/// Description: read train data and test data.
/// Expectation: the data is processed successfully.
/// Description: Read train data and test data.
/// Expectation: The data is processed successfully.
TEST_F(MindDataTestPipeline, TestYahooAnswersDatasetUsageAll) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestYahooAnswersDatasetUsageAll.";
@ -119,8 +119,8 @@ TEST_F(MindDataTestPipeline, TestYahooAnswersDatasetUsageAll) {
}
/// Feature: YahooAnswersDataset.
/// Description: includes tests for shape, type, size.
/// Expectation: the data is processed successfully.
/// Description: Includes tests for shape, type, size.
/// Expectation: The data is processed successfully.
TEST_F(MindDataTestPipeline, TestYahooAnswersDatasetGetters) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestYahooAnswersDatasetGetters.";
@ -148,8 +148,8 @@ TEST_F(MindDataTestPipeline, TestYahooAnswersDatasetGetters) {
}
/// Feature: YahooAnswersDataset.
/// Description: read 2 samples from train file.
/// Expectation: the data is processed successfully.
/// Description: Read 2 samples from train file.
/// Expectation: The data is processed successfully.
TEST_F(MindDataTestPipeline, TestYahooAnswersDatasetNumSamples) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestYahooAnswersDatasetNumSamples.";
@ -195,8 +195,8 @@ TEST_F(MindDataTestPipeline, TestYahooAnswersDatasetNumSamples) {
}
/// Feature: YahooAnswersDataset.
/// Description: test in a distributed state.
/// Expectation: the data is processed successfully.
/// Description: Test in a distributed state.
/// Expectation: The data is processed successfully.
TEST_F(MindDataTestPipeline, TestYahooAnswersDatasetDistribution) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestYahooAnswersDatasetDistribution.";
@ -242,8 +242,8 @@ TEST_F(MindDataTestPipeline, TestYahooAnswersDatasetDistribution) {
}
/// Feature: YahooAnswersDataset.
/// Description: test with invalid input.
/// Expectation: throw error messages when certain errors occur.
/// Description: Test with invalid input.
/// Expectation: Throw error messages when certain errors occur.
TEST_F(MindDataTestPipeline, TestYahooAnswersDatasetFail) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestYahooAnswersDatasetFail.";
// Create a YahooAnswers Dataset.
@ -293,8 +293,8 @@ TEST_F(MindDataTestPipeline, TestYahooAnswersDatasetFail) {
}
/// Feature: YahooAnswersDataset.
/// Description: read data with pipeline from test file.
/// Expectation: the data is processed successfully.
/// Description: Read data with pipeline from test file.
/// Expectation: The data is processed successfully.
TEST_F(MindDataTestPipeline, TestYahooAnswersDatasetWithPipeline) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestYahooAnswersDatasetWithPipeline.";
@ -351,8 +351,8 @@ TEST_F(MindDataTestPipeline, TestYahooAnswersDatasetWithPipeline) {
}
/// Feature: YahooAnswersDataset.
/// Description: test with shuffle files.
/// Expectation: the data is processed successfully.
/// Description: Test with shuffle files.
/// Expectation: The data is processed successfully.
TEST_F(MindDataTestPipeline, TestYahooAnswersDatasetShuffleFilesA) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestYahooAnswersDatasetShuffleFilesA.";
@ -412,8 +412,8 @@ TEST_F(MindDataTestPipeline, TestYahooAnswersDatasetShuffleFilesA) {
}
/// Feature: YahooAnswersDataset.
/// Description: test with shuffle in file.
/// Expectation: the data is processed successfully.
/// Description: Test with shuffle in file.
/// Expectation: The data is processed successfully.
TEST_F(MindDataTestPipeline, TestYahooAnswersDatasetShuffleFilesB) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestYahooAnswersDatasetShuffleFilesB.";
@ -469,8 +469,8 @@ TEST_F(MindDataTestPipeline, TestYahooAnswersDatasetShuffleFilesB) {
}
/// Feature: YahooAnswersDataset.
/// Description: test with global shuffle.
/// Expectation: the data is processed successfully.
/// Description: Test with global shuffle.
/// Expectation: The data is processed successfully.
TEST_F(MindDataTestPipeline, TestYahooAnswersDatasetShuffleGlobal) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestYahooAnswersDatasetShuffleFilesGlobal.";

View File

@ -1,5 +1,5 @@
/**
* Copyright 2021 Huawei Technologies Co., Ltd
* Copyright 2021-2022 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -23,9 +23,9 @@ class MindDataTestPipeline : public UT::DatasetOpTesting {
protected:
};
/// Feature: Test YelpReviewPolarity Dataset.
/// Description: read YelpReviewPolarityDataset data and get data.
/// Expectation: the data is processed successfully.
/// Feature: YelpReviewDataset
/// Description: Test YelpReviewDataset basic usage with polarity dataset
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestYelpReviewPolarityDatasetBasic) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestYelpReviewPolarityDatasetBasic.";
@ -71,9 +71,9 @@ TEST_F(MindDataTestPipeline, TestYelpReviewPolarityDatasetBasic) {
iter->Stop();
}
/// Feature: Test YelpReviewFull Dataset.
/// Description: read YelpReviewFullDataset data and get data.
/// Expectation: the data is processed successfully.
/// Feature: YelpReviewDataset
/// Description: Test YelpReviewDataset basic usage with full dataset
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestYelpReviewFullDatasetBasic) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestYelpReviewFullDatasetBasic.";
@ -119,9 +119,9 @@ TEST_F(MindDataTestPipeline, TestYelpReviewFullDatasetBasic) {
iter->Stop();
}
/// Feature: YelpReviewDatasetWithPipeline.
/// Description: test usage of YelpReviewDataset with pipeline.
/// Expectation: get correct number of data.
/// Feature: YelpReviewDataset
/// Description: Test YelpReviewDataset with pipeline mode
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestYelpReviewDatasetWithPipeline) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestYelpReviewDatasetWithPipeline.";
@ -177,9 +177,9 @@ TEST_F(MindDataTestPipeline, TestYelpReviewDatasetWithPipeline) {
iter->Stop();
}
/// Feature: TestYelpReviewDatasetIteratorOneColumn.
/// Description: test iterator of YelpReviewDataset with only the "text" column.
/// Expectation: get correct data.
/// Feature: YelpReviewDataset
/// Description: Test iterator of YelpReviewDataset with only the text column
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestYelpReviewDatasetIteratorOneColumn) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestYelpReviewIteratorOneColumn.";
// Create a YelpReview dataset
@ -217,9 +217,9 @@ TEST_F(MindDataTestPipeline, TestYelpReviewDatasetIteratorOneColumn) {
iter->Stop();
}
/// Feature: TestYelpReviewDatasetIteratorWrongColumn.
/// Description: test iterator of YelpReviewDataset with wrong column.
/// Expectation: get none piece of data.
/// Feature: YelpReviewDataset
/// Description: Test iterator of YelpReviewDataset with wrong column
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestYelpReviewDatasetIteratorWrongColumn) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestYelpReviewDatasetIteratorWrongColumn.";
// Create a YelpReview dataset
@ -233,9 +233,9 @@ TEST_F(MindDataTestPipeline, TestYelpReviewDatasetIteratorWrongColumn) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: Test YelpReviewPolarity Dataset(usage=all).
/// Description: read train data and test data.
/// Expectation: the data is processed successfully.
/// Feature: YelpReviewDataset
/// Description: Test YelpReviewDataset with all usage and polarity dataset
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestYelpReviewDatasetUsageAll) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestYelpReviewDatasetUsageAll.";
@ -284,9 +284,9 @@ TEST_F(MindDataTestPipeline, TestYelpReviewDatasetUsageAll) {
iter->Stop();
}
/// Feature: Test Getters.
/// Description: includes tests for shape, type, size.
/// Expectation: the data is processed successfully.
/// Feature: YelpReviewDataset
/// Description: Test YelpReviewDataset Getters method
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestYelpReviewDatasetGetters) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestYelpReviewDatasetGetters.";
@ -309,9 +309,9 @@ TEST_F(MindDataTestPipeline, TestYelpReviewDatasetGetters) {
EXPECT_EQ(ds->GetColumnNames(), column_names);
}
/// Feature: Test YelpReview Dataset(num_samples = 2).
/// Description: test whether the interface meets expectations when NumSamples is equal to 2.
/// Expectation: the data is processed successfully.
/// Feature: YelpReviewDataset
/// Description: Test YelpReviewDataset with num_samples=2
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestYelpReviewDatasetNumSamples) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestYelpReviewDatasetNumSamples.";
@ -357,9 +357,9 @@ TEST_F(MindDataTestPipeline, TestYelpReviewDatasetNumSamples) {
iter->Stop();
}
/// Feature: Test YelpReviewDataset in distribution.
/// Description: test interface in a distributed state.
/// Expectation: the data is processed successfully.
/// Feature: YelpReviewDataset
/// Description: Test YelpReviewDataset in distributed state (with num_shards and shard_id)
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestYelpReviewDatasetDistribution) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestYelpReviewDatasetDistribution.";
@ -406,9 +406,9 @@ TEST_F(MindDataTestPipeline, TestYelpReviewDatasetDistribution) {
iter->Stop();
}
/// Feature: Error Test.
/// Description: test the wrong input.
/// Expectation: unable to read in data.
/// Feature: YelpReviewDataset
/// Description: Test YelpReviewDataset with invalid inputs
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestYelpReviewDatasetFail) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestYelpReviewDatasetFail.";
@ -455,9 +455,9 @@ TEST_F(MindDataTestPipeline, TestYelpReviewDatasetFail) {
EXPECT_EQ(iter4, nullptr);
}
/// Feature: Test YelpReview Dataset.
/// Description: test YelpReview Dataset interface in pipeline.
/// Expectation: the data is processed successfully.
/// Feature: YelpReviewDataset
/// Description: Test YelpReviewDataset basic usage with polarity dataset with pipeline mode
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestYelpReviewDatasetBasicWithPipeline) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestYelpReviewDatasetBasicWithPipeline.";
@ -513,9 +513,9 @@ TEST_F(MindDataTestPipeline, TestYelpReviewDatasetBasicWithPipeline) {
iter->Stop();
}
/// Feature: Test YelpReview Dataset(ShuffleMode=kFiles).
/// Description: test YelpReview Dataset interface with different ShuffleMode.
/// Expectation: the data is processed successfully.
/// Feature: YelpReviewDataset
/// Description: Test YelpReviewDataset with ShuffleMode::kFiles
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TesYelpReviewDatasetShuffleFilesA) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TesYelpReviewDatasetShuffleFilesA.";
@ -574,9 +574,9 @@ TEST_F(MindDataTestPipeline, TesYelpReviewDatasetShuffleFilesA) {
GlobalContext::config_manager()->set_num_parallel_workers(original_num_parallel_workers);
}
/// Feature: Test YelpReview Dataset(ShuffleMode=kInfile).
/// Description: test YelpReview Dataset interface with different ShuffleMode.
/// Expectation: the data is processed successfully.
/// Feature: YelpReviewDataset
/// Description: Test YelpReviewDataset with ShuffleMode::kInfile
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TesYelpReviewDatasetShuffleFilesB) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TesYelpReviewDatasetShuffleFilesB.";
@ -636,9 +636,9 @@ TEST_F(MindDataTestPipeline, TesYelpReviewDatasetShuffleFilesB) {
GlobalContext::config_manager()->set_num_parallel_workers(original_num_parallel_workers);
}
/// Feature: Test YelpReview Dataset(ShuffleMode=kGlobal).
/// Description: test YelpReview Dataset interface with different ShuffleMode.
/// Expectation: the data is processed successfully.
/// Feature: YelpReviewDataset
/// Description: Test YelpReviewDataset with ShuffleMode::kGlobal
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TesYelpReviewDatasetShuffleFilesGlobal) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TesYelpReviewDatasetShuffleFilesGlobal.";

View File

@ -1,5 +1,5 @@
/**
* Copyright 2021 Huawei Technologies Co., Ltd
* Copyright 2021-2022 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -25,9 +25,9 @@ class MindDataTestPipeline : public UT::DatasetOpTesting {
protected:
};
/// Feature: Test YesNo dataset.
/// Description: read data from a single file.
/// Expectation: the data is processed successfully.
/// Feature: YesNoDataset
/// Description: Test YesNoDataset using a single file
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestYesNoDataset) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestYesNoDataset.";
// Create a YesNoDataset
@ -62,9 +62,9 @@ TEST_F(MindDataTestPipeline, TestYesNoDataset) {
iter->Stop();
}
/// Feature: Test YesNo dataset.
/// Description: test YesNo dataset with pipeline.
/// Expectation: the data is processed successfully.
/// Feature: YesNoDataset
/// Description: Test YesNoDataset with pipeline mode
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, YesNoDatasetWithPipeline) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-YesNoDatasetWithPipeline.";
@ -116,9 +116,9 @@ TEST_F(MindDataTestPipeline, YesNoDatasetWithPipeline) {
iter->Stop();
}
/// Feature: TestYesNoDatasetIteratorOneColumn.
/// Description: test iterator of YesNo dataset with only the "waveform" column.
/// Expectation: get correct data.
/// Feature: YesNoDataset
/// Description: Test iterator of YesNoDataset with only the waveform column
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestYesNoDatasetIteratorOneColumn) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestYesNoDatasetIteratorOneColumn.";
// Create a YesNo dataset
@ -158,9 +158,9 @@ TEST_F(MindDataTestPipeline, TestYesNoDatasetIteratorOneColumn) {
iter->Stop();
}
/// Feature: TestYesNoGetDatasetIteratorWrongColumn.
/// Description: test iterator of YesNoGetDataset with wrong column.
/// Expectation: get none piece of data.
/// Feature: YesNoDataset
/// Description: Test iterator of YesNoDataset with wrong column
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestYesNoGetDatasetIteratorWrongColumn) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestYesNoGetDatasetIteratorWrongColumn.";
// Create a YesNo dataset
@ -174,9 +174,9 @@ TEST_F(MindDataTestPipeline, TestYesNoGetDatasetIteratorWrongColumn) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: Test YesNo dataset.
/// Description: get the size of YesNo dataset.
/// Expectation: the data is processed successfully.
/// Feature: YesNoDataset
/// Description: Test YesNoDataset GetDatasetSize
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestYesNoGetDatasetSize) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestYesNoGetDatasetSize.";
@ -188,9 +188,9 @@ TEST_F(MindDataTestPipeline, TestYesNoGetDatasetSize) {
EXPECT_EQ(ds->GetDatasetSize(), 3);
}
/// Feature: Test YesNo dataset.
/// Description: getter functions.
/// Expectation: the data is processed successfully.
/// Feature: YesNoDataset
/// Description: Test YesNoDataset Getters method
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestYesNoGetters) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestYesNoMixGetter.";
// Create a YesNo Dataset
@ -221,7 +221,7 @@ TEST_F(MindDataTestPipeline, TestYesNoGetters) {
/// Feature: Test YesNo dataset.
/// Description: DatasetFail tests.
/// Expectation: throw error messages when certain errors occur.
/// Expectation: Throw error messages when certain errors occur.
TEST_F(MindDataTestPipeline, TestYesNoDatasetFail) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestYesNoDatasetFail.";
@ -235,9 +235,9 @@ TEST_F(MindDataTestPipeline, TestYesNoDatasetFail) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: Test YesNo dataset.
/// Description: NullSamplerFail tests.
/// Expectation: Throw error messages when certain errors occur.
/// Feature: YesNoDataset
/// Description: Test YesNoDataset using null sampler
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestYesNoDatasetWithNullSamplerFail) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestYesNo10DatasetWithNullSamplerFail.";

View File

@ -1,5 +1,5 @@
/**
* Copyright 2020-2021 Huawei Technologies Co., Ltd
* Copyright 2020-2022 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -27,6 +27,9 @@ class MindDataTestPipeline : public UT::DatasetOpTesting {
// Tests for datasets (in alphabetical order)
/// Feature: CelebADataset
/// Description: Test CelebADataset with all usage and SequentialSampler
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestCelebADataset) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCelebADataset.";
@ -75,6 +78,9 @@ TEST_F(MindDataTestPipeline, TestCelebADataset) {
iter->Stop();
}
/// Feature: CelebADataset
/// Description: Test CelebADataset with default inputs
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestCelebADefault) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCelebADefault.";
@ -177,6 +183,9 @@ TEST_F(MindDataTestPipeline, TestCelebASubsetRandomSampler) {
iter->Stop();
}
/// Feature: GetRepeatCount
/// Description: Test GetRepeatCount on ImageFolderDataset
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestGetRepeatCount) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestGetRepeatCount.";
@ -193,6 +202,9 @@ TEST_F(MindDataTestPipeline, TestGetRepeatCount) {
EXPECT_EQ(ds->GetRepeatCount(), 3);
}
/// Feature: GetBatchSize
/// Description: Test GetBatchSize on ImageFolderDataset
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestGetBatchSize) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestGetRepeatCount.";
@ -219,6 +231,9 @@ TEST_F(MindDataTestPipeline, TestCelebAGetDatasetSize) {
EXPECT_EQ(ds->GetDatasetSize(), 1);
}
/// Feature: CelebADataset
/// Description: Test CelebADataset with invalid dataset path and invalid dataset type
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestCelebAError) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCelebAError.";
@ -245,6 +260,9 @@ TEST_F(MindDataTestPipeline, TestCelebAError) {
EXPECT_EQ(iter2, nullptr);
}
/// Feature: CelebADataset
/// Description: Test CelebADataset with null sampler
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestCelebADatasetWithNullSamplerError) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCelebADataset.";
@ -259,6 +277,9 @@ TEST_F(MindDataTestPipeline, TestCelebADatasetWithNullSamplerError) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: ImageFolderDataset
/// Description: Test ImageFolderDataset with wrong dataset directory
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestImageFolderWithWrongDatasetDirFail) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestImageFolderWithWrongDatasetDirFail.";
@ -272,6 +293,9 @@ TEST_F(MindDataTestPipeline, TestImageFolderWithWrongDatasetDirFail) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: ImageFolderDataset
/// Description: Test ImageFolderDataset with wrong extension
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestImageFolderFailWithWrongExtensionFail) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestImageFolderFailWithWrongExtensionFail.";
@ -295,6 +319,9 @@ TEST_F(MindDataTestPipeline, TestImageFolderFailWithWrongExtensionFail) {
iter->Stop();
}
/// Feature: ImageFolderDataset
/// Description: Test ImageFolderDataset Getters method
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestImageFolderGetters) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestImageFolderGetDatasetSize.";
@ -310,6 +337,9 @@ TEST_F(MindDataTestPipeline, TestImageFolderGetters) {
EXPECT_EQ(ds->GetDatasetSize(), 44);
}
/// Feature: ImageFolderDataset
/// Description: Test ImageFolderDataset with null sampler
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestImageFolderFailWithNullSamplerFail) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestImageFolderFailWithNullSamplerFail.";
@ -324,6 +354,9 @@ TEST_F(MindDataTestPipeline, TestImageFolderFailWithNullSamplerFail) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: ImageFolderDataset
/// Description: Test ImageFolderDataset with wrong sampler
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestImageFolderFailWithWrongSamplerFail) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestImageFolderFailWithWrongSamplerFail.";
@ -338,6 +371,9 @@ TEST_F(MindDataTestPipeline, TestImageFolderFailWithWrongSamplerFail) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: MnistDataset
/// Description: Test MnistDataset GetDatasetSize
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestMnistGetDatasetSize) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestMnistGetDatasetSize.";
@ -348,6 +384,9 @@ TEST_F(MindDataTestPipeline, TestMnistGetDatasetSize) {
EXPECT_EQ(ds->GetDatasetSize(), 20);
}
/// Feature: MnistDataset
/// Description: Test MnistDataset with wrong dataset directory
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestMnistFailWithWrongDatasetDirFail) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestMnistFailWithWrongDatasetDirFail.";
@ -361,6 +400,9 @@ TEST_F(MindDataTestPipeline, TestMnistFailWithWrongDatasetDirFail) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: MnistDataset
/// Description: Test MnistDataset with null sampler
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestMnistFailWithNullSamplerFail) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestMnistFailWithNullSamplerFail.";
@ -375,6 +417,9 @@ TEST_F(MindDataTestPipeline, TestMnistFailWithNullSamplerFail) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: ImageFolderDataset
/// Description: Test ImageFolderDataset with class_index
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestImageFolderClassIndexDatasetSize) {
std::string folder_path = datasets_root_path_ + "/testPK/data";
std::map<std::string, int32_t> class_index;
@ -384,6 +429,9 @@ TEST_F(MindDataTestPipeline, TestImageFolderClassIndexDatasetSize) {
EXPECT_EQ(ds->GetNumClasses(), 2);
}
/// Feature: ImageFolderDataset
/// Description: Test ImageFolderDataset with wrong class in class_index
/// Expectation: GetNumClasses should return -1
TEST_F(MindDataTestPipeline, TestImageFolderClassIndexDatasetSizeFail) {
std::string folder_path = datasets_root_path_ + "/testPK/data";
std::map<std::string, int32_t> class_index;

View File

@ -1,5 +1,5 @@
/**
* Copyright 2021 Huawei Technologies Co., Ltd
* Copyright 2021-2022 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -23,6 +23,9 @@ class MindDataTestEpochCtrl : public UT::DatasetOpTesting {
protected:
};
/// Feature: Epoch Control
/// Description: Test auto inject epoch (num_epochs > 1)
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestEpochCtrl, TestAutoInjectEpoch) {
MS_LOG(INFO) << "Doing MindDataTestEpochCtrl-TestAutoInjectEpoch.";
@ -72,6 +75,9 @@ TEST_F(MindDataTestEpochCtrl, TestAutoInjectEpoch) {
iter->Stop();
}
/// Feature: Epoch Control
/// Description: Test epoch basic usage
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestEpochCtrl, TestEpoch) {
MS_LOG(INFO) << "Doing MindDataTestEpochCtrl-TestEpoch.";
@ -119,6 +125,9 @@ TEST_F(MindDataTestEpochCtrl, TestEpoch) {
iter->Stop();
}
/// Feature: Epoch Control
/// Description: Test epoch after Repeat op
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestEpochCtrl, TestRepeatEpoch) {
MS_LOG(INFO) << "Doing MindDataTestEpochCtrl-TestRepeatEpoch.";
@ -168,6 +177,9 @@ TEST_F(MindDataTestEpochCtrl, TestRepeatEpoch) {
iter->Stop();
}
/// Feature: Epoch Control
/// Description: Test epoch after 2 Repeat ops
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestEpochCtrl, TestRepeatRepeatEpoch) {
MS_LOG(INFO) << "Doing MindDataTestEpochCtrl-TestRepeatRepeatEpoch.";

View File

@ -1,5 +1,5 @@
/**
* Copyright 2021 Huawei Technologies Co., Ltd
* Copyright 2021-2022 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -24,6 +24,9 @@ class MindDataTestPipeline : public UT::DatasetOpTesting {
protected:
};
/// Feature: PullBasedIterator
/// Description: Test PullBasedIterator after Batch op
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestPullBasedBatch) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestAlbumBasic.";
@ -49,6 +52,9 @@ TEST_F(MindDataTestPipeline, TestPullBasedBatch) {
EXPECT_EQ(row[0].Shape(), result);
}
/// Feature: PullBasedIterator
/// Description: Test PullBasedIterator after Project op
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestPullBasedProject) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestAlbumBasic.";

View File

@ -1,5 +1,5 @@
/**
* Copyright 2021 Huawei Technologies Co., Ltd
* Copyright 2021-2022 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -23,6 +23,9 @@ class MindDataTestPipeline : public UT::DatasetOpTesting {
protected:
};
/// Feature: Repeat op
/// Description: Test Repeat op after SetNumWorkers is called
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestRepeatSetNumWorkers) {
MS_LOG(INFO) << "Doing MindDataTestRepeat-TestRepeatSetNumWorkers.";

View File

@ -1,5 +1,5 @@
/**
* Copyright 2020-2021 Huawei Technologies Co., Ltd
* Copyright 2020-2022 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -26,6 +26,9 @@ class MindDataTestPipeline : public UT::DatasetOpTesting {
protected:
};
/// Feature: Sampler
/// Description: Test ImageFolderDataset with various samplers
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestImageFolderWithSamplers) {
std::shared_ptr<Sampler> sampl = std::make_shared<DistributedSampler>(2, 1);
EXPECT_NE(sampl, nullptr);
@ -125,6 +128,9 @@ TEST_F(MindDataTestPipeline, TestWeightedRandomSamplerImageFolder) {
iter->Stop();
}
/// Feature: Sampler
/// Description: Test ImageFolderDataset with no sampler provided (defaults to RandomSampler)
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestNoSamplerSuccess1) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestNoSamplerSuccess1.";
// Test building a dataset with no sampler provided (defaults to random sampler
@ -151,6 +157,9 @@ TEST_F(MindDataTestPipeline, TestNoSamplerSuccess1) {
iter->Stop();
}
/// Feature: Sampler
/// Description: Test basic setting of DistributedSampler through shared pointer
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestDistributedSamplerSuccess1) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestDistributedSamplerSuccess1.";
// Test basic setting of distributed_sampler
@ -181,6 +190,9 @@ TEST_F(MindDataTestPipeline, TestDistributedSamplerSuccess1) {
iter->Stop();
}
/// Feature: Sampler
/// Description: Test basic setting of DistributedSampler through new definition
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestDistributedSamplerSuccess2) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestDistributedSamplerSuccess2.";
// Test basic setting of distributed_sampler
@ -215,6 +227,9 @@ TEST_F(MindDataTestPipeline, TestDistributedSamplerSuccess2) {
delete sampler;
}
/// Feature: Sampler
/// Description: Test basic setting of DistributedSampler through object definition
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestDistributedSamplerSuccess3) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestDistributedSamplerSuccess3.";
// Test basic setting of distributed_sampler
@ -244,6 +259,9 @@ TEST_F(MindDataTestPipeline, TestDistributedSamplerSuccess3) {
iter->Stop();
}
/// Feature: Sampler
/// Description: Test pointer of DistributedSampler
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestDistributedSamplerSuccess4) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestDistributedSamplerSuccess4.";
// Test pointer of distributed_sampler
@ -339,6 +357,9 @@ TEST_F(MindDataTestPipeline, TestDistributedSamplerSuccess6) {
iter->Stop();
}
/// Feature: Sampler
/// Description: Test DistributedSampler with num_shards < offset through shared pointer
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestDistributedSamplerFail1) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestDistributedSamplerFail1.";
// Test basic setting of distributed_sampler
@ -358,6 +379,9 @@ TEST_F(MindDataTestPipeline, TestDistributedSamplerFail1) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: Sampler
/// Description: Test DistributedSampler with num_shards < offset through new definition
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestDistributedSamplerFail2) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestDistributedSamplerFail2.";
// Test basic setting of distributed_sampler
@ -381,6 +405,9 @@ TEST_F(MindDataTestPipeline, TestDistributedSamplerFail2) {
delete sampler;
}
/// Feature: Sampler
/// Description: Test DistributedSampler with num_shards < offset through object definition
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestDistributedSamplerFail3) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestDistributedSamplerFail3.";
// Test basic setting of distributed_sampler
@ -399,6 +426,9 @@ TEST_F(MindDataTestPipeline, TestDistributedSamplerFail3) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: Sampler
/// Description: Test DistributedSampler with SequentialSampler as child sampler
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestSamplerAddChild) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSamplerAddChild.";
@ -593,6 +623,9 @@ TEST_F(MindDataTestPipeline, TestSamplerAddChild5) {
iter->Stop();
}
/// Feature: Sampler
/// Description: Test basic setting of SubsetSampler with default num_samples
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestSubsetSamplerSuccess1) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSubsetSamplerSuccess1.";
// Test basic setting of subset_sampler with default num_samples
@ -624,6 +657,9 @@ TEST_F(MindDataTestPipeline, TestSubsetSamplerSuccess1) {
iter->Stop();
}
/// Feature: Sampler
/// Description: Test SubsetSampler with num_samples provided
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestSubsetSamplerSuccess2) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSubsetSamplerSuccess2.";
// Test subset_sampler with num_samples
@ -655,6 +691,9 @@ TEST_F(MindDataTestPipeline, TestSubsetSamplerSuccess2) {
iter->Stop();
}
/// Feature: Sampler
/// Description: Test SubsetSampler with num_samples larger than the indices size
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestSubsetSamplerSuccess3) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSubsetSamplerSuccess3.";
// Test subset_sampler with num_samples larger than the indices size.
@ -686,6 +725,9 @@ TEST_F(MindDataTestPipeline, TestSubsetSamplerSuccess3) {
iter->Stop();
}
/// Feature: Sampler
/// Description: Test SubsetSampler with index out of bounds
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestSubsetSamplerFail) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSubsetSamplerFail.";
// Test subset_sampler with index out of bounds.

View File

@ -1,5 +1,5 @@
/**
* Copyright 2020-2021 Huawei Technologies Co., Ltd
* Copyright 2020-2022 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -34,6 +34,9 @@ class MindDataTestPipeline : public UT::DatasetOpTesting {
protected:
};
/// Feature: SentencePieceVocab
/// Description: Test SentencePieceVocab with SentencePieceTokenizer op from vocab object
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestSentencePieceVocabSuccess1) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSentencePieceVocabSuccess1 plus sentencepiece tokenizer.";
@ -93,6 +96,9 @@ TEST_F(MindDataTestPipeline, TestSentencePieceVocabSuccess1) {
iter->Stop();
}
/// Feature: SentencePieceVocab
/// Description: Test SentencePieceVocab with SentencePieceTokenizer op from local vocab model
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestSentencePieceVocabSuccess2) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSentencePieceVocabSuccess2 plus sentencepiece tokenizer.";
@ -156,6 +162,9 @@ TEST_F(MindDataTestPipeline, TestSentencePieceVocabSuccess2) {
iter->Stop();
}
/// Feature: SentencePieceVocab
/// Description: Test SentencePieceVocab with incorrect parameters
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestSentencePieceVocabFail) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSentencePieceVocabFail1 with incorrect parameter.";
@ -185,6 +194,9 @@ TEST_F(MindDataTestPipeline, TestSentencePieceVocabFail) {
EXPECT_EQ(vocab4, nullptr);
}
/// Feature: SentencePieceTokenizer op
/// Description: Test SentencePieceTokenizer op with local vocab model equal to empty string
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestSentencePieceTokenizerFail1) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSentencePieceTokenizerFail with incorrect parameter.";
@ -209,6 +221,9 @@ TEST_F(MindDataTestPipeline, TestSentencePieceTokenizerFail1) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: SentencePieceTokenizer op
/// Description: Test SentencePieceTokenizer op with incorrect local vocab model
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestSentencePieceTokenizerFail2) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSentencePieceTokenizerFail2 with incorrect parameter.";
@ -233,6 +248,9 @@ TEST_F(MindDataTestPipeline, TestSentencePieceTokenizerFail2) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: SentencePieceTokenizer op
/// Description: Test SentencePieceTokenizer op with nullptr as vocab model
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestSentencePieceTokenizerFail3) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSentencePieceTokenizerFail3 with incorrect parameter.";
@ -257,6 +275,9 @@ TEST_F(MindDataTestPipeline, TestSentencePieceTokenizerFail3) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: SentencePieceTokenizer op
/// Description: Test SentencePieceTokenizer op with invalid SentencePieceVocab object
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestSentencePieceTokenizerFail4) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSentencePieceTokenizerFail with invalid SentencePieceVocab object.";

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
/**
* Copyright 2020-2021 Huawei Technologies Co., Ltd
* Copyright 2020-2022 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -41,8 +41,8 @@ class MindDataTestPipeline : public UT::DatasetOpTesting {
} while (false)
/// Feature: C++ text.Vocab class.
/// Description: test TokensToIds() IdsToTokens() methods of text::Vocab.
/// Expectation: success.
/// Description: Test TokensToIds() IdsToTokens() methods of text::Vocab.
/// Expectation: Success.
TEST_F(MindDataTestPipeline, TestVocabLookupAndReverseLookup) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestVocabLookupAndReverseLookup.";
// Create a vocab from vector
@ -80,6 +80,9 @@ TEST_F(MindDataTestPipeline, TestVocabLookupAndReverseLookup) {
EXPECT_EQ(multi_words, expected_multi_words);
}
/// Feature: C++ text.Vocab class
/// Description: Test Lookup op basic usage
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestVocabLookupOp) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestVocabLookupOp.";
@ -134,6 +137,9 @@ TEST_F(MindDataTestPipeline, TestVocabLookupOp) {
iter->Stop();
}
/// Feature: C++ text.Vocab class
/// Description: Test Lookup op using an empty string as the unknown_token
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestVocabLookupOpEmptyString) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestVocabLookupOpEmptyString.";
@ -188,6 +194,9 @@ TEST_F(MindDataTestPipeline, TestVocabLookupOpEmptyString) {
iter->Stop();
}
/// Feature: C++ text.Vocab class
/// Description: Test Lookup op with mindspore::DataType::kNumberTypeBool
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestVocabLookupBool) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestVocabLookupBool.";
// Invoke Lookup with Bool data_type
@ -237,6 +246,9 @@ TEST_F(MindDataTestPipeline, TestVocabLookupBool) {
iter->Stop();
}
/// Feature: C++ text.Vocab class
/// Description: Test Lookup op with an unknown token that is not a word of vocab
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestVocabLookupOpFail1) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestVocabLookupOpFail1.";
// Create a TextFile Dataset
@ -264,6 +276,9 @@ TEST_F(MindDataTestPipeline, TestVocabLookupOpFail1) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: C++ text.Vocab class
/// Description: Test Lookup op with null vocab
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestVocabLookupOpFail2) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestVocabLookupOpFail2.";
// Create a TextFile Dataset
@ -288,6 +303,9 @@ TEST_F(MindDataTestPipeline, TestVocabLookupOpFail2) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: C++ text.Vocab class
/// Description: Test Lookup op with mindspore::DataType::kObjectTypeString
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestVocabLookupOpFail3DataType) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestVocabLookupOpFail3DataType.";
// Create a TextFile Dataset
@ -315,6 +333,9 @@ TEST_F(MindDataTestPipeline, TestVocabLookupOpFail3DataType) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: C++ text.Vocab class
/// Description: Test BuildVocab using a dataset
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestVocabFromDataset) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestVocabFromDataset.";
@ -372,6 +393,9 @@ TEST_F(MindDataTestPipeline, TestVocabFromDataset) {
iter->Stop();
}
/// Feature: C++ text.Vocab class
/// Description: Test BuildVocab with default parameters
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestVocabFromDatasetDefault) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestVocabFromDatasetDefault.";
@ -436,6 +460,9 @@ TEST_F(MindDataTestPipeline, TestVocabFromDatasetDefault) {
iter->Stop();
}
/// Feature: C++ text.Vocab class
/// Description: Test BuildVocab where top_k is negative
/// Expectation: Throw correct error and message
TEST_F(MindDataTestPipeline, TestVocabFromDatasetFail1) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestVocabFromDatasetFail1.";
@ -451,6 +478,9 @@ TEST_F(MindDataTestPipeline, TestVocabFromDatasetFail1) {
EXPECT_EQ(vocab, nullptr);
}
/// Feature: C++ text.Vocab class
/// Description: Test BuildVocab where frequency_range [a, b] is a > b
/// Expectation: Throw correct error and message
TEST_F(MindDataTestPipeline, TestVocabFromDatasetFail2) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestVocabFromDatasetFail2.";
@ -466,6 +496,9 @@ TEST_F(MindDataTestPipeline, TestVocabFromDatasetFail2) {
EXPECT_EQ(vocab, nullptr);
}
/// Feature: C++ text.Vocab class
/// Description: Test BuildVocab where column name does not exist in dataset
/// Expectation: Throw correct error and message
TEST_F(MindDataTestPipeline, TestVocabFromDatasetFail3) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestVocabFromDatasetFail3.";
@ -480,6 +513,9 @@ TEST_F(MindDataTestPipeline, TestVocabFromDatasetFail3) {
EXPECT_EQ(vocab, nullptr);
}
/// Feature: C++ text.Vocab class
/// Description: Test BuildVocab where special tokens are already in the dataset
/// Expectation: Throw correct error and message
TEST_F(MindDataTestPipeline, TestVocabFromDatasetFail4) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestVocabFromDatasetFail4.";
@ -495,6 +531,9 @@ TEST_F(MindDataTestPipeline, TestVocabFromDatasetFail4) {
EXPECT_EQ(vocab, nullptr);
}
/// Feature: C++ text.Vocab class
/// Description: Test BuildVocab from dataset and Lookup op with mindspore::DataType::kNumberTypeInt64
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestVocabFromDatasetInt64) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestVocabFromDatasetInt64.";

View File

@ -1,5 +1,5 @@
/**
* Copyright 2020-2021 Huawei Technologies Co., Ltd
* Copyright 2020-2022 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -30,6 +30,9 @@ class MindDataTestPipeline : public UT::DatasetOpTesting {
// Tests for data transforms ops (in alphabetical order)
/// Feature: Compose op
/// Description: Test Compose op basic usage
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestComposeSuccess) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestComposeSuccess.";
@ -39,8 +42,8 @@ TEST_F(MindDataTestPipeline, TestComposeSuccess) {
EXPECT_NE(ds, nullptr);
// Create objects for the tensor ops
std::shared_ptr<TensorTransform> decode_op(new vision::Decode());
std::shared_ptr<TensorTransform> resize_op(new vision::Resize({777, 777}));
auto decode_op = std::make_shared<vision::Decode>();
auto resize_op = std::make_shared<vision::Resize>(std::vector<int32_t>{777, 777});
transforms::Compose compose({decode_op, resize_op});
// Create a Map operation on ds
@ -74,6 +77,9 @@ TEST_F(MindDataTestPipeline, TestComposeSuccess) {
iter->Stop();
}
/// Feature: Compose op
/// Description: Test Compose op with invalid transform op
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestComposeFail1) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestComposeFail1 with invalid transform.";
@ -97,6 +103,9 @@ TEST_F(MindDataTestPipeline, TestComposeFail1) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: Compose op
/// Description: Test Compose op with null transform op
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestComposeFail2) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestComposeFail2 with invalid transform.";
@ -107,7 +116,8 @@ TEST_F(MindDataTestPipeline, TestComposeFail2) {
// Compose: transform ops must not be null
std::shared_ptr<TensorTransform> decode_op = std::make_shared<vision::Decode>();
std::shared_ptr<TensorTransform> compose(new transforms::Compose({decode_op, nullptr}));
auto compose = std::make_shared<transforms::Compose>(
std::vector<std::shared_ptr<TensorTransform>>{decode_op, nullptr});
// Create a Map operation on ds
ds = ds->Map({compose}, {"image"});
@ -118,6 +128,9 @@ TEST_F(MindDataTestPipeline, TestComposeFail2) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: Compose op
/// Description: Test Compose op with empty transform list
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestComposeFail3) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestComposeFail3 with invalid transform.";
@ -139,6 +152,9 @@ TEST_F(MindDataTestPipeline, TestComposeFail3) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: Concatenate op
/// Description: Test basic Concatenate op with prepend and append
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestConcatenateSuccess1) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestConcatenateSuccess1.";
// Test basic concatenate with prepend and append
@ -204,6 +220,9 @@ TEST_F(MindDataTestPipeline, TestConcatenateSuccess1) {
GlobalContext::config_manager()->set_seed(curr_seed);
}
/// Feature: Concatenate op
/// Description: Test Concatenate op with no input
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestConcatenateSuccess2) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestConcatenateSuccess2.";
// Test concatenate with no input
@ -256,6 +275,9 @@ TEST_F(MindDataTestPipeline, TestConcatenateSuccess2) {
GlobalContext::config_manager()->set_seed(curr_seed);
}
/// Feature: Concatenate op
/// Description: Test Concatenate op with strings
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestConcatenateSuccess3) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestConcatenateSuccess3.";
// Test concatenate of string
@ -327,6 +349,9 @@ TEST_F(MindDataTestPipeline, TestConcatenateSuccess3) {
// GlobalContext::config_manager()->set_seed(curr_seed);
}
/// Feature: Concatenate op
/// Description: Test Concatenate op with negative axis
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestConcatenateSuccess4) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestConcatenateSuccess4.";
// Test concatenate with negative axis
@ -392,6 +417,9 @@ TEST_F(MindDataTestPipeline, TestConcatenateSuccess4) {
GlobalContext::config_manager()->set_seed(curr_seed);
}
/// Feature: Concatenate op
/// Description: Test Concatenate op with type mismatch
/// Expectation: Throw correct error and message
TEST_F(MindDataTestPipeline, TestConcatenateFail1) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestConcatenateFail1.";
// Test concatenate with type mismatch
@ -441,6 +469,9 @@ TEST_F(MindDataTestPipeline, TestConcatenateFail1) {
GlobalContext::config_manager()->set_seed(curr_seed);
}
/// Feature: Concatenate op
/// Description: Test Concatenate op with incorrect dimension
/// Expectation: Throw correct error and message
TEST_F(MindDataTestPipeline, TestConcatenateFail2) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestConcatenateFail2.";
// Test concatenate with incorrect dimension
@ -489,6 +520,9 @@ TEST_F(MindDataTestPipeline, TestConcatenateFail2) {
GlobalContext::config_manager()->set_seed(curr_seed);
}
/// Feature: Concatenate op
/// Description: Test Concatenate op with wrong axis
/// Expectation: Throw correct error and message
TEST_F(MindDataTestPipeline, TestConcatenateFail3) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestConcatenateFail3.";
// Test concatenate with wrong axis
@ -531,6 +565,9 @@ TEST_F(MindDataTestPipeline, TestConcatenateFail3) {
GlobalContext::config_manager()->set_seed(curr_seed);
}
/// Feature: Duplicate op
/// Description: Test Duplicate op basic usage
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestDuplicateSuccess) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestDuplicateSuccess.";
@ -571,6 +608,9 @@ TEST_F(MindDataTestPipeline, TestDuplicateSuccess) {
iter->Stop();
}
/// Feature: Fill op
/// Description: Test Fill op basic usage on RandomDataset with Int32 numbers for given shape
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestFillSuccessInt) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestFillSuccessInt.";
@ -626,6 +666,9 @@ TEST_F(MindDataTestPipeline, TestFillSuccessInt) {
GlobalContext::config_manager()->set_seed(curr_seed);
}
/// Feature: Fill op
/// Description: Test Fill op basic usage on RandomDataset with bool values for given shape
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestFillSuccessBool) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestFillSuccessBool.";
@ -680,6 +723,10 @@ TEST_F(MindDataTestPipeline, TestFillSuccessBool) {
GlobalContext::config_manager()->set_seed(curr_seed);
}
/// Feature: Fill op
/// Description: Test Fill op using negative numbers on RandomDataset with UInt8 numbers for given shape,
/// so there will be down typecasting
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestFillSuccessDownTypecast) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestFillSuccessDownTypecast.";
@ -735,6 +782,10 @@ TEST_F(MindDataTestPipeline, TestFillSuccessDownTypecast) {
GlobalContext::config_manager()->set_seed(curr_seed);
}
/// Feature: Fill op
/// Description: Test Fill op using 0 on RandomDataset with UInt8 numbers for given shape,
/// so there will be down typecasting to 0
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestFillSuccessDownTypecastZero) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestFillSuccessDownTypecastZero.";
@ -789,6 +840,10 @@ TEST_F(MindDataTestPipeline, TestFillSuccessDownTypecastZero) {
GlobalContext::config_manager()->set_seed(curr_seed);
}
/// Feature: Fill op
/// Description: Test Fill op using negative numbers on RandomDataset with UInt16 numbers for given shape,
/// so there will be down typecasting
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestFillSuccessDownTypecast16) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestFillSuccessDownTypecast16.";
@ -845,6 +900,10 @@ TEST_F(MindDataTestPipeline, TestFillSuccessDownTypecast16) {
GlobalContext::config_manager()->set_seed(curr_seed);
}
/// Feature: Fill op
/// Description: Test Fill op using 0 on RandomDataset with Float numbers for given shape,
/// so there will be up typecasting to 0 scalar value
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestFillSuccessUpTypecast) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestFillSuccessUpTypecast.";
@ -899,6 +958,9 @@ TEST_F(MindDataTestPipeline, TestFillSuccessUpTypecast) {
GlobalContext::config_manager()->set_seed(curr_seed);
}
/// Feature: Fill op
/// Description: Test Fill op on TextFileDataset which contains strings
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestFillSuccessString) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestFillSuccessString.";
@ -958,6 +1020,9 @@ TEST_F(MindDataTestPipeline, TestFillSuccessString) {
iter->Stop();
}
/// Feature: Fill op
/// Description: Test Fill op with wrongful vector shape instead of scalar
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestFillFailFillValueNotScalar) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestFillFailFillValueNotScalar.";
// Test BasicTokenizer with lower_case true
@ -997,6 +1062,9 @@ TEST_F(MindDataTestPipeline, TestFillFailFillValueNotScalar) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: Mask op
/// Description: Test Mask op on RandomDataset with Int16 data type with int
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestMaskSuccess1) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestMaskSuccess1.";
// Test Mask random int dataset with int
@ -1051,6 +1119,9 @@ TEST_F(MindDataTestPipeline, TestMaskSuccess1) {
GlobalContext::config_manager()->set_seed(curr_seed);
}
/// Feature: Mask op
/// Description: Test Mask op on RandomDataset with Float16 data type with float
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestMaskSuccess2) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestMaskSuccess2.";
// Test Mask random float dataset with float
@ -1147,6 +1218,9 @@ TEST_F(MindDataTestPipeline, TestMaskSuccess2) {
GlobalContext::config_manager()->set_seed(curr_seed);
}
/// Feature: Mask op
/// Description: Test Mask op on TextFileDataset with strings
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestMaskSuccess3) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestMaskSuccess3.";
// Test Mask random text dataset with string
@ -1209,6 +1283,9 @@ TEST_F(MindDataTestPipeline, TestMaskSuccess3) {
iter->Stop();
}
/// Feature: Mask op
/// Description: Test Mask op with nun-numeric datatype as output result
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestMaskFail1) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestMaskFail1.";
// Test Mask with nun-numeric datatype as output result.
@ -1242,6 +1319,9 @@ TEST_F(MindDataTestPipeline, TestMaskFail1) {
GlobalContext::config_manager()->set_seed(curr_seed);
}
/// Feature: Mask op
/// Description: Test Mask op with mismatched datatype
/// Expectation: Throw correct error and message
TEST_F(MindDataTestPipeline, TestMaskFail2) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestMaskFail2.";
// Test Mask with mismatched datatype.
@ -1280,6 +1360,9 @@ TEST_F(MindDataTestPipeline, TestMaskFail2) {
GlobalContext::config_manager()->set_seed(curr_seed);
}
/// Feature: OneHot op
/// Description: Test OneHot op basic usage
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestOneHotSuccess1) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestOneHotSuccess1.";
// Testing CutMixBatch on a batch of CHW images
@ -1345,6 +1428,9 @@ TEST_F(MindDataTestPipeline, TestOneHotSuccess1) {
iter->Stop();
}
/// Feature: OneHot op
/// Description: Test OneHot op followed by MixUpBatch op
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestOneHotSuccess2) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestOneHotSuccess2.";
// Create a Cifar10 Dataset
@ -1393,6 +1479,9 @@ TEST_F(MindDataTestPipeline, TestOneHotSuccess2) {
iter->Stop();
}
/// Feature: OneHot op
/// Description: Test OneHot op with invalid num_class=0
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestOneHotFail1) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestOneHotFail1 with invalid params.";
@ -1413,6 +1502,9 @@ TEST_F(MindDataTestPipeline, TestOneHotFail1) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: OneHot op
/// Description: Test OneHot op with invalid num_class < 0
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestOneHotFail2) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestOneHotFail2 with invalid params.";
@ -1433,6 +1525,9 @@ TEST_F(MindDataTestPipeline, TestOneHotFail2) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: PadEnd op
/// Description: Test PadEnd op basic usage with int as pad_value
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestPadEndSuccess1) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestPadEndSuccess1.";
// Test PadEnd basic with int as pad_value
@ -1487,6 +1582,9 @@ TEST_F(MindDataTestPipeline, TestPadEndSuccess1) {
GlobalContext::config_manager()->set_seed(curr_seed);
}
/// Feature: PadEnd op
/// Description: Test PadEnd op with pad_shape equals to the current shape, nothing padded
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestPadEndSuccess2) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestPadEndSuccess2.";
// Test PadEnd with pad_shape equals to current shape, nothing padded
@ -1541,6 +1639,9 @@ TEST_F(MindDataTestPipeline, TestPadEndSuccess2) {
GlobalContext::config_manager()->set_seed(curr_seed);
}
/// Feature: PadEnd op
/// Description: Test PadEnd op without pad_value (using default pad_value)
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestPadEndSuccess3) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestPadEndSuccess3.";
// Test PadEnd without pad_value (using default pad_value)
@ -1590,6 +1691,9 @@ TEST_F(MindDataTestPipeline, TestPadEndSuccess3) {
GlobalContext::config_manager()->set_seed(curr_seed);
}
/// Feature: PadEnd op
/// Description: Test PadEnd op with pad_shape less than current shape, will truncate the values
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestPadEndSuccess4) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestPadEndSuccess4.";
// Test PadEnd with pad_shape less than current shape, will truncate the values
@ -1644,6 +1748,9 @@ TEST_F(MindDataTestPipeline, TestPadEndSuccess4) {
GlobalContext::config_manager()->set_seed(curr_seed);
}
/// Feature: PadEnd op
/// Description: Test PadEnd op with string as pad_value
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestPadEndSuccess5) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestPadEndSuccess5.";
// Test PadEnd with string as pad_value
@ -1704,6 +1811,9 @@ TEST_F(MindDataTestPipeline, TestPadEndSuccess5) {
iter->Stop();
}
/// Feature: PadEnd op
/// Description: Test PadEnd op with type mismatch, source and pad_value are not of the same type
/// Expectation: Throw correct error and message
TEST_F(MindDataTestPipeline, TestPadEndFail) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestPadEndFail.";
// Test PadEnd with type mismatch, source and pad_value are not of the same type.
@ -1743,6 +1853,9 @@ TEST_F(MindDataTestPipeline, TestPadEndFail) {
GlobalContext::config_manager()->set_seed(curr_seed);
}
/// Feature: RandomApply op
/// Description: Test RandomApply op basic usage
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestRandomApplySuccess) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRandomApplySuccess.";
@ -1784,6 +1897,9 @@ TEST_F(MindDataTestPipeline, TestRandomApplySuccess) {
iter->Stop();
}
/// Feature: RandomApply op
/// Description: Test RandomApply op with invalid transform op
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestRandomApplyFail1) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRandomApplyFail1 with invalid transform.";
@ -1807,6 +1923,9 @@ TEST_F(MindDataTestPipeline, TestRandomApplyFail1) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: RandomApply op
/// Description: Test RandomApply op with null transform op
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestRandomApplyFail2) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRandomApplyFail2 with invalid transform.";
@ -1817,7 +1936,8 @@ TEST_F(MindDataTestPipeline, TestRandomApplyFail2) {
// RandomApply: transform ops must not be null
std::shared_ptr<TensorTransform> decode_op = std::make_shared<vision::Decode>();
std::shared_ptr<TensorTransform> random_apply(new transforms::RandomApply({decode_op, nullptr}));
auto random_apply = std::make_shared<transforms::RandomApply>(
std::vector<std::shared_ptr<TensorTransform>>{decode_op, nullptr});
// Create a Map operation on ds
ds = ds->Map({random_apply}, {"image"});
@ -1828,6 +1948,9 @@ TEST_F(MindDataTestPipeline, TestRandomApplyFail2) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: RandomApply op
/// Description: Test RandomApply op probability out of range
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestRandomApplyFail3) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRandomApplyFail3 with invalid transform.";
@ -1849,6 +1972,9 @@ TEST_F(MindDataTestPipeline, TestRandomApplyFail3) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: RandomApply op
/// Description: Test RandomApply op with empty transform list
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestRandomApplyFail4) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRandomApplyFail4 with invalid transform.";
@ -1870,6 +1996,9 @@ TEST_F(MindDataTestPipeline, TestRandomApplyFail4) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: RandomChoice op
/// Description: Test RandomChoice op basic usage
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestRandomChoiceSuccess) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRandomChoiceSuccess.";
@ -1879,8 +2008,8 @@ TEST_F(MindDataTestPipeline, TestRandomChoiceSuccess) {
EXPECT_NE(ds, nullptr);
// Create objects for the tensor ops
std::shared_ptr<TensorTransform> resize_op1(new vision::Resize({777, 777}));
std::shared_ptr<TensorTransform> resize_op2(new vision::Resize({888, 888}));
auto resize_op1 = std::make_shared<vision::Resize>(std::vector<int32_t>{777, 777});
auto resize_op2 = std::make_shared<vision::Resize>(std::vector<int32_t>{888, 888});
auto random_choice = transforms::RandomChoice({resize_op1, resize_op2});
// Create a Map operation on ds
@ -1912,6 +2041,9 @@ TEST_F(MindDataTestPipeline, TestRandomChoiceSuccess) {
iter->Stop();
}
/// Feature: RandomChoice op
/// Description: Test RandomChoice op with invalid transform op
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestRandomChoiceFail1) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRandomChoiceFail1 with invalid transform.";
@ -1936,6 +2068,9 @@ TEST_F(MindDataTestPipeline, TestRandomChoiceFail1) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: RandomChoice op
/// Description: Test RandomChoice op with null transform op
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestRandomChoiceFail2) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRandomChoiceFail2 with invalid transform.";
@ -1946,7 +2081,8 @@ TEST_F(MindDataTestPipeline, TestRandomChoiceFail2) {
// RandomChoice: transform ops must not be null
std::shared_ptr<TensorTransform> decode_op = std::make_shared<vision::Decode>();
std::shared_ptr<TensorTransform> random_choice(new transforms::RandomApply({decode_op, nullptr}));
auto random_choice = std::make_shared<transforms::RandomApply>(
std::vector<std::shared_ptr<TensorTransform>>{decode_op, nullptr});
// Create a Map operation on ds
ds = ds->Map({random_choice}, {"image"});
@ -1957,6 +2093,9 @@ TEST_F(MindDataTestPipeline, TestRandomChoiceFail2) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: RandomChoice op
/// Description: Test RandomChoice op with empty transform list
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestRandomChoiceFail3) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRandomChoiceFail3 with invalid transform.";
@ -1978,6 +2117,9 @@ TEST_F(MindDataTestPipeline, TestRandomChoiceFail3) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: Slice op
/// Description: Test Slice op with user defined slice object
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestSliceSuccess1) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSliceSuccess1.";
// Test Slice int with user defined slice object.
@ -2042,6 +2184,9 @@ TEST_F(MindDataTestPipeline, TestSliceSuccess1) {
GlobalContext::config_manager()->set_seed(curr_seed);
}
/// Feature: Slice op
/// Description: Test Slice op on int dataset with bool true (slice all)
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestSliceSuccess2) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSliceSuccess2.";
// Test Slice int with bool true (slice all).
@ -2107,6 +2252,9 @@ TEST_F(MindDataTestPipeline, TestSliceSuccess2) {
GlobalContext::config_manager()->set_seed(curr_seed);
}
/// Feature: Slice op
/// Description: Test Slice op on int dataset with list of indices including negative
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestSliceSuccess3) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSliceSuccess3.";
// Test Slice int with list of indices including negative.
@ -2172,6 +2320,9 @@ TEST_F(MindDataTestPipeline, TestSliceSuccess3) {
GlobalContext::config_manager()->set_seed(curr_seed);
}
/// Feature: Slice op
/// Description: Test Slice op on string dataset with list of indices
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestSliceSuccess4) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSliceSuccess4.";
// Test Slice string with list of indices.
@ -2230,6 +2381,9 @@ TEST_F(MindDataTestPipeline, TestSliceSuccess4) {
iter->Stop();
}
/// Feature: Slice op
/// Description: Test Slice op on int dataset on multi-dimension
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestSliceSuccess5) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSliceSuccess5.";
// Test Slice int on multi-dimension.
@ -2290,6 +2444,9 @@ TEST_F(MindDataTestPipeline, TestSliceSuccess5) {
GlobalContext::config_manager()->set_seed(curr_seed);
}
/// Feature: Slice op
/// Description: Test Slice op with index out of bounds
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestSliceFail1) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSliceFail.";
// Test Slice with index out of bounds.
@ -2326,6 +2483,9 @@ TEST_F(MindDataTestPipeline, TestSliceFail1) {
GlobalContext::config_manager()->set_seed(curr_seed);
}
/// Feature: Slice op
/// Description: Test Slice op with false as input for SliceOption only (no other index nor slice list provided)
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestSliceFail2) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestSliceFail2.";
// Test Slice with false as input SliceOption only (no other index nor slice list provided)
@ -2373,6 +2533,9 @@ TEST_F(MindDataTestPipeline, TestSliceFail2) {
GlobalContext::config_manager()->set_seed(curr_seed);
}
/// Feature: TypeCast op
/// Description: Test TypeCast op basic usage
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestTypeCastSuccess) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestTypeCastSuccess.";
@ -2423,6 +2586,9 @@ TEST_F(MindDataTestPipeline, TestTypeCastSuccess) {
iter2->Stop();
}
/// Feature: TypeCast op
/// Description: Test TypeCast op with incorrect data type
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestTypeCastFail) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestTypeCastFail with invalid param.";

View File

@ -1,5 +1,5 @@
/**
* Copyright 2020-2021 Huawei Technologies Co., Ltd
* Copyright 2020-2022 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -28,6 +28,9 @@ class MindDataTestPipeline : public UT::DatasetOpTesting {
// Tests for vision C++ API A to Q TensorTransform Operations (in alphabetical order)
/// Feature: AdjustGamma op
/// Description: Test AdjustGamma op on 3 channels dataset
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestAdjustGamma3Channel) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestAdjustGamma3Channel.";
std::string MindDataPath = "data/dataset";
@ -65,6 +68,9 @@ TEST_F(MindDataTestPipeline, TestAdjustGamma3Channel) {
iter2->Stop();
}
/// Feature: AdjustGamma op
/// Description: Test AdjustGamma op on 3 channels dataset transformed to 1 channel dataset
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestAdjustGamma1Channel) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestAdjustGamma1Channel.";
std::string MindDataPath = "data/dataset";
@ -103,6 +109,9 @@ TEST_F(MindDataTestPipeline, TestAdjustGamma1Channel) {
iter2->Stop();
}
/// Feature: AdjustGamma op
/// Description: Test AdjustGamma op with negative gamma
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestAdjustGammaParamCheck) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestAdjustGammaParamCheck.";
std::string MindDataPath = "data/dataset";
@ -112,7 +121,7 @@ TEST_F(MindDataTestPipeline, TestAdjustGammaParamCheck) {
// Case 1: Negative gamma
// Create objects for the tensor ops
std::shared_ptr<TensorTransform> adjust_gamma(new vision::AdjustGamma(-1, 1.0));
auto adjust_gamma = std::make_shared<vision::AdjustGamma>(-1, 1.0);
auto ds1 = ds->Map({adjust_gamma});
EXPECT_NE(ds1, nullptr);
// Create an iterator over the result of the above dataset
@ -121,6 +130,9 @@ TEST_F(MindDataTestPipeline, TestAdjustGammaParamCheck) {
EXPECT_EQ(iter1, nullptr);
}
/// Feature: AutoContrast op
/// Description: Test AutoContrast op with default values
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestAutoContrastSuccess1) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestAutoContrastSuccess1.";
@ -135,7 +147,7 @@ TEST_F(MindDataTestPipeline, TestAutoContrastSuccess1) {
EXPECT_NE(ds, nullptr);
// Create auto contrast object with default values
std::shared_ptr<TensorTransform> auto_contrast(new vision::AutoContrast());
auto auto_contrast = std::make_shared<vision::AutoContrast>();
// Note: No need to check for output after calling API class constructor
// Create a Map operation on ds
@ -170,6 +182,9 @@ TEST_F(MindDataTestPipeline, TestAutoContrastSuccess1) {
iter->Stop();
}
/// Feature: AutoContrast op
/// Description: Test AutoContrast op basic usage
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestAutoContrastSuccess2) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestAutoContrastSuccess2.";
@ -184,7 +199,7 @@ TEST_F(MindDataTestPipeline, TestAutoContrastSuccess2) {
EXPECT_NE(ds, nullptr);
// Create auto contrast object
std::shared_ptr<TensorTransform> auto_contrast(new vision::AutoContrast(10, {10, 20}));
auto auto_contrast = std::make_shared<vision::AutoContrast>(10, std::vector<uint32_t>{10, 20});
// Note: No need to check for output after calling API class constructor
// Create a Map operation on ds
@ -219,6 +234,9 @@ TEST_F(MindDataTestPipeline, TestAutoContrastSuccess2) {
iter->Stop();
}
/// Feature: CenterCrop op
/// Description: Test CenterCrop op with single integer input
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestCenterCrop) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCenterCrop with single integer input.";
@ -233,7 +251,7 @@ TEST_F(MindDataTestPipeline, TestCenterCrop) {
EXPECT_NE(ds, nullptr);
// Create centre crop object with square crop
std::shared_ptr<TensorTransform> centre_out1(new vision::CenterCrop({30}));
auto centre_out1 = std::make_shared<vision::CenterCrop>(std::vector<int32_t>{30});
// Note: No need to check for output after calling API class constructor
// Create a Map operation on ds
@ -268,6 +286,9 @@ TEST_F(MindDataTestPipeline, TestCenterCrop) {
iter->Stop();
}
/// Feature: CenterCrop op
/// Description: Test CenterCrop op basic usage
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestCropSuccess) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCropSuccess.";
@ -279,7 +300,7 @@ TEST_F(MindDataTestPipeline, TestCropSuccess) {
// Create a crop object
int height = 20;
int width = 25;
std::shared_ptr<TensorTransform> crop(new vision::Crop({0, 0}, {height, width}));
auto crop = std::make_shared<vision::Crop>(std::vector<int32_t>{0, 0}, std::vector<int32_t>{height, width});
// Note: No need to check for output after calling API class constructor
// Create a Map operation on ds
@ -315,6 +336,9 @@ TEST_F(MindDataTestPipeline, TestCropSuccess) {
iter->Stop();
}
/// Feature: CenterCrop op
/// Description: Test CenterCrop op with invalid parameters
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestCropParamCheck) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCropParamCheck with invalid parameters.";
@ -325,7 +349,7 @@ TEST_F(MindDataTestPipeline, TestCropParamCheck) {
// Case 1: Value of coordinates is negative
// Create objects for the tensor ops
std::shared_ptr<TensorTransform> crop1(new vision::Crop({-1, -1}, {20}));
auto crop1 = std::make_shared<vision::Crop>(std::vector<int32_t>{-1, -1}, std::vector<int32_t>{20});
auto ds1 = ds->Map({crop1});
EXPECT_NE(ds1, nullptr);
// Create an iterator over the result of the above dataset
@ -335,7 +359,7 @@ TEST_F(MindDataTestPipeline, TestCropParamCheck) {
// Case 2: Size of coordinates is not 2
// Create objects for the tensor ops
std::shared_ptr<TensorTransform> crop2(new vision::Crop({5}, {10}));
auto crop2 = std::make_shared<vision::Crop>(std::vector<int32_t>{5}, std::vector<int32_t>{10});
auto ds2 = ds->Map({crop2});
EXPECT_NE(ds2, nullptr);
// Create an iterator over the result of the above dataset
@ -345,7 +369,7 @@ TEST_F(MindDataTestPipeline, TestCropParamCheck) {
// Case 3: Value of size is negative
// Create objects for the tensor ops
std::shared_ptr<TensorTransform> crop3(new vision::Crop({0, 0}, {-10, -5}));
auto crop3 = std::make_shared<vision::Crop>(std::vector<int32_t>{0, 0}, std::vector<int32_t>{-10, -5});
auto ds3 = ds->Map({crop3});
EXPECT_NE(ds3, nullptr);
// Create an iterator over the result of the above dataset
@ -355,7 +379,7 @@ TEST_F(MindDataTestPipeline, TestCropParamCheck) {
// Case 4: Size is neither a single number nor a vector of size 2
// Create objects for the tensor ops
std::shared_ptr<TensorTransform> crop4(new vision::Crop({0, 0}, {10, 10, 10}));
auto crop4 = std::make_shared<vision::Crop>(std::vector<int32_t>{0, 0}, std::vector<int32_t>{10, 10, 10});
auto ds4 = ds->Map({crop4});
EXPECT_NE(ds4, nullptr);
// Create an iterator over the result of the above dataset
@ -364,6 +388,9 @@ TEST_F(MindDataTestPipeline, TestCropParamCheck) {
EXPECT_EQ(iter4, nullptr);
}
/// Feature: CutMixBatch op
/// Description: Test CutMixBatch op on a batch of CHW images
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestCutMixBatchSuccess1) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCutMixBatchSuccess1.";
// Testing CutMixBatch on a batch of CHW images
@ -433,6 +460,9 @@ TEST_F(MindDataTestPipeline, TestCutMixBatchSuccess1) {
iter->Stop();
}
/// Feature: CutMixBatch op
/// Description: Test CutMixBatch op on a batch of HWC images with default values of alpha and prob
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestCutMixBatchSuccess2) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCutMixBatchSuccess2.";
// Calling CutMixBatch on a batch of HWC images with default values of alpha and prob
@ -495,6 +525,9 @@ TEST_F(MindDataTestPipeline, TestCutMixBatchSuccess2) {
iter->Stop();
}
/// Feature: CutMixBatch op
/// Description: Test CutMixBatch op with invalid negative alpha parameter
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestCutMixBatchFail1) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCutMixBatchFail1 with invalid negative alpha parameter.";
@ -530,6 +563,9 @@ TEST_F(MindDataTestPipeline, TestCutMixBatchFail1) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: CutMixBatch op
/// Description: Test CutMixBatch op with invalid negative prob parameter
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestCutMixBatchFail2) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCutMixBatchFail2 with invalid negative prob parameter.";
@ -565,6 +601,9 @@ TEST_F(MindDataTestPipeline, TestCutMixBatchFail2) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: CutMixBatch op
/// Description: Test CutMixBatch op with invalid zero alpha parameter
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestCutMixBatchFail3) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCutMixBatchFail3 with invalid zero alpha parameter.";
@ -600,6 +639,9 @@ TEST_F(MindDataTestPipeline, TestCutMixBatchFail3) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: CutMixBatch op
/// Description: Test CutMixBatch op with invalid prob parameter that is greater than 1
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestCutMixBatchFail4) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCutMixBatchFail4 with invalid greater than 1 prob parameter.";
@ -634,6 +676,9 @@ TEST_F(MindDataTestPipeline, TestCutMixBatchFail4) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: CutOut op
/// Description: Test CutOut op basic usage
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestCutOut) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestCutOut.";
@ -684,6 +729,9 @@ TEST_F(MindDataTestPipeline, TestCutOut) {
iter->Stop();
}
/// Feature: Decode op
/// Description: Test Decode op basic usage
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestDecode) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestDecode.";
@ -732,6 +780,9 @@ TEST_F(MindDataTestPipeline, TestDecode) {
iter->Stop();
}
/// Feature: HWC2CHW op
/// Description: Test HWC2CHW basic usage
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestHwcToChw) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestHwcToChw.";
@ -784,6 +835,9 @@ TEST_F(MindDataTestPipeline, TestHwcToChw) {
iter->Stop();
}
/// Feature: Invert op
/// Description: Test Invert op basic usage
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestInvert) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestInvert.";
@ -822,6 +876,9 @@ TEST_F(MindDataTestPipeline, TestInvert) {
iter->Stop();
}
/// Feature: MixUpBatch op
/// Description: Test MixUpBatch op with negative alpha parameter
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestMixUpBatchFail1) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestMixUpBatchFail1 with negative alpha parameter.";
@ -856,6 +913,9 @@ TEST_F(MindDataTestPipeline, TestMixUpBatchFail1) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: MixUpBatch op
/// Description: Test MixUpBatch op with zero alpha parameter
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestMixUpBatchFail2) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestMixUpBatchFail2 with zero alpha parameter.";
@ -890,6 +950,9 @@ TEST_F(MindDataTestPipeline, TestMixUpBatchFail2) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: MixUpBatch op
/// Description: Test MixUpBatch op with explicit valid alpha parameter
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestMixUpBatchSuccess1) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestMixUpBatchSuccess1 with explicit alpha parameter.";
@ -941,6 +1004,9 @@ TEST_F(MindDataTestPipeline, TestMixUpBatchSuccess1) {
iter->Stop();
}
/// Feature: MixUpBatch op
/// Description: Test MixUpBatch op with default alpha parameter
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestMixUpBatchSuccess2) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestMixUpBatchSuccess1 with default alpha parameter.";
@ -992,6 +1058,9 @@ TEST_F(MindDataTestPipeline, TestMixUpBatchSuccess2) {
iter->Stop();
}
/// Feature: Normalize op
/// Description: Test Normalize op basic usage
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestNormalize) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestNormalize.";
@ -1006,7 +1075,8 @@ TEST_F(MindDataTestPipeline, TestNormalize) {
EXPECT_NE(ds, nullptr);
// Create objects for the tensor ops
std::shared_ptr<TensorTransform> normalize(new vision::Normalize({121.0, 115.0, 0.0}, {70.0, 68.0, 71.0}));
auto normalize = std::make_shared<vision::Normalize>(
std::vector<float>{121.0, 115.0, 0.0}, std::vector<float>{70.0, 68.0, 71.0});
// Note: No need to check for output after calling API class constructor
// Create a Map operation on ds
@ -1041,6 +1111,9 @@ TEST_F(MindDataTestPipeline, TestNormalize) {
iter->Stop();
}
/// Feature: NormalizePad op
/// Description: Test NormalizePad op basic usage
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestNormalizePad) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestNormalizePad.";
@ -1055,8 +1128,8 @@ TEST_F(MindDataTestPipeline, TestNormalizePad) {
EXPECT_NE(ds, nullptr);
// Create objects for the tensor ops
std::shared_ptr<TensorTransform> normalizepad(
new vision::NormalizePad({121.0, 115.0, 100.0}, {70.0, 68.0, 71.0}, "float32"));
auto normalizepad = std::make_shared<vision::NormalizePad>(
std::vector<float>{121.0, 115.0, 100.0}, std::vector<float>{70.0, 68.0, 71.0}, "float32");
// Note: No need to check for output after calling API class constructor
// Create a Map operation on ds
@ -1088,6 +1161,9 @@ TEST_F(MindDataTestPipeline, TestNormalizePad) {
iter->Stop();
}
/// Feature: Pad op
/// Description: Test Pad op basic usage
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestPad) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestPad.";
@ -1102,9 +1178,12 @@ TEST_F(MindDataTestPipeline, TestPad) {
EXPECT_NE(ds, nullptr);
// Create objects for the tensor ops
std::shared_ptr<TensorTransform> pad_op1(new vision::Pad({1, 2, 3, 4}, {0}, BorderType::kSymmetric));
std::shared_ptr<TensorTransform> pad_op2(new vision::Pad({1}, {1, 1, 1}, BorderType::kEdge));
std::shared_ptr<TensorTransform> pad_op3(new vision::Pad({1, 4}));
auto pad_op1 = std::make_shared<vision::Pad>(
std::vector<int32_t>{1, 2, 3, 4}, std::vector<uint8_t>{0}, BorderType::kSymmetric);
auto pad_op2 = std::make_shared<vision::Pad>(
std::vector<int32_t>{1}, std::vector<uint8_t>{1, 1, 1}, BorderType::kEdge);
auto pad_op3 = std::make_shared<vision::Pad>(
std::vector<int32_t>{1, 4});
// Note: No need to check for output after calling API class constructor
// Create a Map operation on ds
@ -1139,6 +1218,9 @@ TEST_F(MindDataTestPipeline, TestPad) {
iter->Stop();
}
/// Feature: ConvertColor op
/// Description: Test ConvertColor op with ConvertMode::COLOR_RGB2GRAY
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestConvertColorSuccess1) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestConvertColorSuccess1.";
// Create an ImageFolder Dataset
@ -1146,8 +1228,8 @@ TEST_F(MindDataTestPipeline, TestConvertColorSuccess1) {
std::shared_ptr<Dataset> ds = ImageFolder(folder_path, true, std::make_shared<RandomSampler>(false, 1));
EXPECT_NE(ds, nullptr);
// Create objects for the tensor ops
std::shared_ptr<TensorTransform> resize_op(new vision::Resize({500, 1000}));
std::shared_ptr<TensorTransform> convert(new mindspore::dataset::vision::ConvertColor(ConvertMode::COLOR_RGB2GRAY));
auto resize_op = std::make_shared<vision::Resize>(std::vector<int32_t>{500, 1000});
auto convert = std::make_shared<mindspore::dataset::vision::ConvertColor>(ConvertMode::COLOR_RGB2GRAY);
ds = ds->Map({resize_op, convert});
EXPECT_NE(ds, nullptr);
@ -1176,6 +1258,9 @@ TEST_F(MindDataTestPipeline, TestConvertColorSuccess1) {
iter->Stop();
}
/// Feature: ConvertColor op
/// Description: Test ConvertColor op with ConvertMode::COLOR_RGB2BGR
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestConvertColorSuccess2) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestConvertColorSuccess2.";
// Create an ImageFolder Dataset
@ -1183,8 +1268,8 @@ TEST_F(MindDataTestPipeline, TestConvertColorSuccess2) {
std::shared_ptr<Dataset> ds = ImageFolder(folder_path, true, std::make_shared<RandomSampler>(false, 1));
EXPECT_NE(ds, nullptr);
// Create objects for the tensor ops
std::shared_ptr<TensorTransform> resize_op(new vision::Resize({500, 1000}));
std::shared_ptr<TensorTransform> convert(new mindspore::dataset::vision::ConvertColor(ConvertMode::COLOR_RGB2BGR));
auto resize_op = std::make_shared<vision::Resize>(std::vector<int32_t>{500, 1000});
auto convert = std::make_shared<mindspore::dataset::vision::ConvertColor>(ConvertMode::COLOR_RGB2BGR);
ds = ds->Map({resize_op, convert});
EXPECT_NE(ds, nullptr);
@ -1213,6 +1298,9 @@ TEST_F(MindDataTestPipeline, TestConvertColorSuccess2) {
iter->Stop();
}
/// Feature: ConvertColor op
/// Description: Test ConvertColor op with ConvertMode::COLOR_RGB2RGBA
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestConvertColorSuccess3) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestConvertColorSuccess3.";
// Create an ImageFolder Dataset
@ -1220,8 +1308,8 @@ TEST_F(MindDataTestPipeline, TestConvertColorSuccess3) {
std::shared_ptr<Dataset> ds = ImageFolder(folder_path, true, std::make_shared<RandomSampler>(false, 1));
EXPECT_NE(ds, nullptr);
// Create objects for the tensor ops
std::shared_ptr<TensorTransform> resize_op(new vision::Resize({500, 1000}));
std::shared_ptr<TensorTransform> convert(new mindspore::dataset::vision::ConvertColor(ConvertMode::COLOR_RGB2RGBA));
auto resize_op = std::make_shared<vision::Resize>(std::vector<int32_t>{500, 1000});
auto convert = std::make_shared<mindspore::dataset::vision::ConvertColor>(ConvertMode::COLOR_RGB2RGBA);
ds = ds->Map({resize_op, convert});
EXPECT_NE(ds, nullptr);
@ -1250,6 +1338,9 @@ TEST_F(MindDataTestPipeline, TestConvertColorSuccess3) {
iter->Stop();
}
/// Feature: ConvertColor op
/// Description: Test ConvertColor op with invalid ConvertMode
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestConvertColorFail) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestConvertColorFail.";
// Create an ImageFolder Dataset
@ -1260,8 +1351,8 @@ TEST_F(MindDataTestPipeline, TestConvertColorFail) {
ConvertMode error_convert_mode = static_cast<ConvertMode>(50);
// Create objects for the tensor ops
std::shared_ptr<TensorTransform> resize_op(new vision::Resize({500, 1000}));
std::shared_ptr<TensorTransform> convert(new mindspore::dataset::vision::ConvertColor(error_convert_mode));
auto resize_op = std::make_shared<vision::Resize>(std::vector<int32_t>{500, 1000});
auto convert = std::make_shared<mindspore::dataset::vision::ConvertColor>(error_convert_mode);
ds = ds->Map({resize_op, convert});
EXPECT_NE(ds, nullptr);
@ -1272,9 +1363,9 @@ TEST_F(MindDataTestPipeline, TestConvertColorFail) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: AutoAugment
/// Description: test AutoAugment pipeline
/// Expectation: create an ImageFolder dataset then do auto augmentation on it with the policy
/// Feature: AutoAugment op
/// Description: Test AutoAugment op pipeline
/// Expectation: Create an ImageFolder dataset then do auto augmentation on it with the policy
TEST_F(MindDataTestPipeline, TestAutoAugment) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestAutoAugment.";
@ -1305,9 +1396,9 @@ TEST_F(MindDataTestPipeline, TestAutoAugment) {
iter->Stop();
}
/// Feature: AutoAugment
/// Description: test AutoAugment with invalid fill_value
/// Expectation: pipeline iteration failed with wrong argument fill_value
/// Feature: AutoAugment op
/// Description: Test AutoAugment op with invalid fill_value
/// Expectation: Pipeline iteration failed with wrong argument fill_value
TEST_F(MindDataTestPipeline, TestAutoAugmentInvalidFillValue) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestAutoAugmentInvalidFillValue.";
@ -1327,8 +1418,8 @@ TEST_F(MindDataTestPipeline, TestAutoAugmentInvalidFillValue) {
}
/// Feature: GetImageNumChannels
/// Description: test GetImageNumChannels with pipeline mode
/// Expectation: the returned result is as expected
/// Description: Test GetImageNumChannels with pipeline mode
/// Expectation: The returned result is as expected
TEST_F(MindDataTestPipeline, TestGetImageNumChannelsPipeline) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestGetImageNumChannelsPipeline.";
@ -1344,8 +1435,8 @@ TEST_F(MindDataTestPipeline, TestGetImageNumChannelsPipeline) {
}
/// Feature: GetImageNumChannels
/// Description: test GetImageNumChannels with invalid input
/// Expectation: the returned result is as expected
/// Description: Test GetImageNumChannels with invalid input
/// Expectation: The returned result is as expected
TEST_F(MindDataTestPipeline, TestGetImageNumChannelsInValidInput) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestGetImageNumChannelsInValidInput.";
@ -1358,8 +1449,8 @@ TEST_F(MindDataTestPipeline, TestGetImageNumChannelsInValidInput) {
}
/// Feature: GetImageSize
/// Description: test GetImageSize with pipeline mode
/// Expectation: the returned result is as expected
/// Description: Test GetImageSize with pipeline mode
/// Expectation: The returned result is as expected
TEST_F(MindDataTestPipeline, TestGetImageSizePipeline) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestGetImageSizePipeline.";
@ -1374,8 +1465,8 @@ TEST_F(MindDataTestPipeline, TestGetImageSizePipeline) {
}
/// Feature: GetImageSize
/// Description: test GetImageSize with invalid input
/// Expectation: the returned result is as expected
/// Description: Test GetImageSize with invalid input
/// Expectation: The returned result is as expected
TEST_F(MindDataTestPipeline, TestGetImageSizeInValidInput) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestGetImageSizeInValidInput.";
@ -1386,9 +1477,9 @@ TEST_F(MindDataTestPipeline, TestGetImageSizeInValidInput) {
ASSERT_FALSE(ImageSize(input_tensor, &size));
}
/// Feature: PadToSize
/// Description: test default usage
/// Expectation: samples processed successfully
/// Feature: PadToSize op
/// Description: Test default usage
/// Expectation: Samples processed successfully
TEST_F(MindDataTestPipeline, TestPadToSize) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestPadToSize.";
@ -1426,9 +1517,9 @@ TEST_F(MindDataTestPipeline, TestPadToSize) {
iter->Stop();
}
/// Feature: PadToSize
/// Description: test parameter check
/// Expectation: error logs are as expected
/// Feature: PadToSize op
/// Description: Test parameter check
/// Expectation: Error logs are as expected
TEST_F(MindDataTestPipeline, TestPadToSizeInvalid) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestPadToSizeInvalid.";

View File

@ -1,5 +1,5 @@
/**
* Copyright 2021 Huawei Technologies Co., Ltd
* Copyright 2021-2022 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -39,9 +39,9 @@ TEST_F(MindDataTestPipeline, TestAffineAPI) {
// Create auto contrast object with default values
std::shared_ptr<TensorTransform> crop(new vision::RandomCrop({256, 256}));
std::shared_ptr<TensorTransform> affine(
new vision::Affine(0.0, {0.0, 0.0}, 0.0, {0.0, 0.0}, InterpolationMode::kLinear));
auto crop = std::make_shared<vision::RandomCrop>(std::vector<int32_t>{256, 256});
auto affine = std::make_shared<vision::Affine>(
0.0, std::vector<float>{0.0, 0.0}, 0.0, std::vector<float>{0.0, 0.0}, InterpolationMode::kLinear);
// Create a Map operation on ds
ds = ds->Map({crop, affine});
@ -82,9 +82,9 @@ TEST_F(MindDataTestPipeline, TestAffineAPIFail) {
// Create auto contrast object with default values
std::shared_ptr<TensorTransform> crop(new vision::RandomCrop({256, 256}));
std::shared_ptr<TensorTransform> affine(
new vision::Affine(0.0, {2.0, -1.0}, 0.0, {0.0, 0.0}, InterpolationMode::kLinear));
auto crop = std::make_shared<vision::RandomCrop>(std::vector<int32_t>{256, 256});
auto affine = std::make_shared<vision::Affine>(
0.0, std::vector<float>{2.0, -1.0}, 0.0, std::vector<float>{0.0, 0.0}, InterpolationMode::kLinear);
// Create a Map operation on ds
ds = ds->Map({crop, affine});

View File

@ -1,5 +1,5 @@
/**
* Copyright 2020-2021 Huawei Technologies Co., Ltd
* Copyright 2020-2022 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -26,6 +26,9 @@ class MindDataTestPipeline : public UT::DatasetOpTesting {
// Tests for vision C++ API BoundingBoxAugment TensorTransform Operation
/// Feature: BoundingBoxAugment op
/// Description: Test BoundingBoxAugment op defined with shared pointer
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestBoundingBoxAugmentSuccess1Shr) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestBoundingBoxAugmentSuccess1Shr.";
// Create an VOC Dataset
@ -36,8 +39,8 @@ TEST_F(MindDataTestPipeline, TestBoundingBoxAugmentSuccess1Shr) {
// Create objects for the tensor ops
// Use shared pointers
std::shared_ptr<TensorTransform> random_rotation_op(new vision::RandomRotation({90.0}));
std::shared_ptr<TensorTransform> bound_box_augment_op(new vision::BoundingBoxAugment({random_rotation_op}, 1.0));
auto random_rotation_op = std::make_shared<vision::RandomRotation>(std::vector<float>{90.0});
auto bound_box_augment_op = std::make_shared<vision::BoundingBoxAugment>(random_rotation_op, 1.0);
// Create a Map operation on ds
ds = ds->Map({bound_box_augment_op}, {"image", "bbox"}, {"image", "bbox"}, {"image", "bbox"});
@ -65,6 +68,9 @@ TEST_F(MindDataTestPipeline, TestBoundingBoxAugmentSuccess1Shr) {
iter->Stop();
}
/// Feature: BoundingBoxAugment op
/// Description: Test BoundingBoxAugment op defined with new and auto
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestBoundingBoxAugmentSuccess2Auto) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestBoundingBoxAugmentSuccess2Auto.";
// Create an VOC Dataset
@ -109,6 +115,9 @@ TEST_F(MindDataTestPipeline, TestBoundingBoxAugmentSuccess2Auto) {
delete bound_box_augment_op;
}
/// Feature: BoundingBoxAugment op
/// Description: Test BoundingBoxAugment op defined through object definition
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestBoundingBoxAugmentSuccess3Obj) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestBoundingBoxAugmentSuccess3Obj.";
// Create an VOC Dataset
@ -148,6 +157,9 @@ TEST_F(MindDataTestPipeline, TestBoundingBoxAugmentSuccess3Obj) {
iter->Stop();
}
/// Feature: BoundingBoxAugment op
/// Description: Test BoundingBoxAugment op with invalid ratio < 0.0
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestBoundingBoxAugmentFail1) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestBoundingBoxAugmentFail1 with invalid ratio parameter.";
@ -158,10 +170,10 @@ TEST_F(MindDataTestPipeline, TestBoundingBoxAugmentFail1) {
EXPECT_NE(ds, nullptr);
// Create objects for the tensor ops
std::shared_ptr<TensorTransform> random_rotation_op(new vision::RandomRotation({90.0}));
auto random_rotation_op = std::make_shared<vision::RandomRotation>(std::vector<float>{90.0});
// Create BoundingBoxAugment op with invalid ratio < 0.0
std::shared_ptr<TensorTransform> bound_box_augment_op(new vision::BoundingBoxAugment({random_rotation_op}, -1.0));
auto bound_box_augment_op = std::make_shared<vision::BoundingBoxAugment>(random_rotation_op, -1.0);
// Create a Map operation on ds
ds = ds->Map({bound_box_augment_op}, {"image", "bbox"}, {"image", "bbox"}, {"image", "bbox"});
@ -173,6 +185,9 @@ TEST_F(MindDataTestPipeline, TestBoundingBoxAugmentFail1) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: BoundingBoxAugment op
/// Description: Test BoundingBoxAugment op with invalid ratio > 1.0
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestBoundingBoxAugmentFail2) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestBoundingBoxAugmentFail2 with invalid ratio parameter.";
@ -183,10 +198,10 @@ TEST_F(MindDataTestPipeline, TestBoundingBoxAugmentFail2) {
EXPECT_NE(ds, nullptr);
// Create objects for the tensor ops
std::shared_ptr<TensorTransform> random_rotation_op(new vision::RandomRotation({90.0}));
auto random_rotation_op = std::make_shared<vision::RandomRotation>(std::vector<float>{90.0});
// Create BoundingBoxAugment op with invalid ratio > 1.0
std::shared_ptr<TensorTransform> bound_box_augment_op(new vision::BoundingBoxAugment({random_rotation_op}, 2.0));
auto bound_box_augment_op = std::make_shared<vision::BoundingBoxAugment>(random_rotation_op, 2.0);
// Create a Map operation on ds
ds = ds->Map({bound_box_augment_op}, {"image", "bbox"}, {"image", "bbox"}, {"image", "bbox"});
@ -198,6 +213,9 @@ TEST_F(MindDataTestPipeline, TestBoundingBoxAugmentFail2) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: BoundingBoxAugment op
/// Description: Test BoundingBoxAugment op with invalid nullptr transform op
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestBoundingBoxAugmentFail3) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestBoundingBoxAugmentFail3 with invalid transform.";
@ -208,7 +226,7 @@ TEST_F(MindDataTestPipeline, TestBoundingBoxAugmentFail3) {
EXPECT_NE(ds, nullptr);
// Create BoundingBoxAugment op with invalid nullptr transform
std::shared_ptr<TensorTransform> bound_box_augment_op(new vision::BoundingBoxAugment(nullptr, 0.5));
auto bound_box_augment_op = std::make_shared<vision::BoundingBoxAugment>(nullptr, 0.5);
// Create a Map operation on ds
ds = ds->Map({bound_box_augment_op}, {"image", "bbox"}, {"image", "bbox"}, {"image", "bbox"});
@ -220,6 +238,9 @@ TEST_F(MindDataTestPipeline, TestBoundingBoxAugmentFail3) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: BoundingBoxAugment op
/// Description: Test BoundingBoxAugment op with invalid transform input
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestBoundingBoxAugmentFail4) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestBoundingBoxAugmentFail4 with invalid transform input.";
@ -231,10 +252,10 @@ TEST_F(MindDataTestPipeline, TestBoundingBoxAugmentFail4) {
// Create objects for the tensor ops
// RandomRotation has invalid input, first column value of degrees is greater than the second column value
std::shared_ptr<TensorTransform> random_rotation_op(new vision::RandomRotation({50.0, -50.0}));
auto random_rotation_op = std::make_shared<vision::RandomRotation>(std::vector<float>{50.0, -50.0});
// Create BoundingBoxAugment op with invalid transform
std::shared_ptr<TensorTransform> bound_box_augment_op(new vision::BoundingBoxAugment({random_rotation_op}, 0.25));
auto bound_box_augment_op = std::make_shared<vision::BoundingBoxAugment>(random_rotation_op, 0.25);
// Create a Map operation on ds
ds = ds->Map({bound_box_augment_op}, {"image", "bbox"}, {"image", "bbox"}, {"image", "bbox"});

View File

@ -1,5 +1,5 @@
/**
* Copyright 2021 Huawei Technologies Co., Ltd
* Copyright 2021-2022 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -25,6 +25,9 @@ class MindDataTestGaussianBlur : public UT::DatasetOpTesting {
protected:
};
/// Feature: GaussianBlur op
/// Description: Test GaussianBlur op with invalid parameters
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestGaussianBlur, TestGaussianBlurParamCheck) {
MS_LOG(INFO) << "Doing MindDataTestGaussianBlur-TestGaussianBlurParamCheck with invalid parameters.";
// Create an ImageFolder Dataset
@ -34,7 +37,7 @@ TEST_F(MindDataTestGaussianBlur, TestGaussianBlurParamCheck) {
// Case 1: Kernel size is not positive
// Create objects for the tensor ops
std::shared_ptr<TensorTransform> gaussian_blur1(new vision::GaussianBlur({-1}));
auto gaussian_blur1 = std::make_shared<vision::GaussianBlur>(std::vector<int32_t>{-1});
auto ds1 = ds->Map({gaussian_blur1});
EXPECT_NE(ds1, nullptr);
// Create an iterator over the result of the above dataset
@ -44,7 +47,7 @@ TEST_F(MindDataTestGaussianBlur, TestGaussianBlurParamCheck) {
// Case 2: Kernel size is not odd
// Create objects for the tensor ops
std::shared_ptr<TensorTransform> gaussian_blur2(new vision::GaussianBlur({2, 2}, {3, 3}));
auto gaussian_blur2 = std::make_shared<vision::GaussianBlur>(std::vector<int32_t>{2, 2}, std::vector<float>{3, 3});
auto ds2 = ds->Map({gaussian_blur2});
EXPECT_NE(ds2, nullptr);
// Create an iterator over the result of the above dataset
@ -54,7 +57,7 @@ TEST_F(MindDataTestGaussianBlur, TestGaussianBlurParamCheck) {
// Case 3: Sigma is not positive
// Create objects for the tensor ops
std::shared_ptr<TensorTransform> gaussian_blur3(new vision::GaussianBlur({3}, {-3}));
auto gaussian_blur3 = std::make_shared<vision::GaussianBlur>(std::vector<int32_t>{3}, std::vector<float>{-3});
auto ds3 = ds->Map({gaussian_blur3});
EXPECT_NE(ds3, nullptr);
// Create an iterator over the result of the above dataset
@ -63,6 +66,9 @@ TEST_F(MindDataTestGaussianBlur, TestGaussianBlurParamCheck) {
EXPECT_EQ(iter3, nullptr);
}
/// Feature: GaussianBlur op
/// Description: Test GaussianBlur op in pipeline mode
/// Expectation: Runs successfully
TEST_F(MindDataTestGaussianBlur, TestGaussianBlurPipeline) {
MS_LOG(INFO) << "Doing MindDataTestGaussianBlur-TestGaussianBlurPipeline.";
@ -72,7 +78,7 @@ TEST_F(MindDataTestGaussianBlur, TestGaussianBlurPipeline) {
EXPECT_NE(ds, nullptr);
// Create objects for the tensor ops
std::shared_ptr<TensorTransform> gaussian_blur(new vision::GaussianBlur({3, 3}, {5, 5}));
auto gaussian_blur = std::make_shared<vision::GaussianBlur>(std::vector<int32_t>{3, 3}, std::vector<float>{5, 5});
// Create a Map operation on ds
ds = ds->Map({gaussian_blur});
@ -106,6 +112,9 @@ TEST_F(MindDataTestGaussianBlur, TestGaussianBlurPipeline) {
iter->Stop();
}
/// Feature: GaussianBlur op
/// Description: Test GaussianBlur op in eager mode
/// Expectation: Runs successfully
TEST_F(MindDataTestGaussianBlur, TestGaussianBlurEager) {
MS_LOG(INFO) << "Doing MindDataTestGaussianBlur-TestGaussianBlurEager.";

View File

@ -1,5 +1,5 @@
/**
* Copyright 2021 Huawei Technologies Co., Ltd
* Copyright 2021-2022 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -25,6 +25,9 @@ class MindDataTestHorizontalFlip : public UT::DatasetOpTesting {
protected:
};
/// Feature: HorizontalFlip op
/// Description: Test HorizontalFlip op in pipeline mode
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestHorizontalFlip, TestHorizontalFlipPipeline) {
MS_LOG(INFO) << "Doing MindDataTestHorizontalFlip-TestHorizontalFlipPipeline.";
@ -34,7 +37,7 @@ TEST_F(MindDataTestHorizontalFlip, TestHorizontalFlipPipeline) {
EXPECT_NE(ds, nullptr);
// Create objects for the tensor ops
std::shared_ptr<TensorTransform> horizontal_flip(new vision::HorizontalFlip());
auto horizontal_flip = std::make_shared<vision::HorizontalFlip>();
// Create a Map operation on ds
ds = ds->Map({horizontal_flip});
@ -68,6 +71,9 @@ TEST_F(MindDataTestHorizontalFlip, TestHorizontalFlipPipeline) {
iter->Stop();
}
/// Feature: HorizontalFlip op
/// Description: Test HorizontalFlip op in eager mode
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestHorizontalFlip, TestHorizontalFlipEager) {
MS_LOG(INFO) << "Doing MindDataTestHorizontalFlip-TestHorizontalFlipEager.";

View File

@ -1,5 +1,5 @@
/**
* Copyright 2020-2021 Huawei Technologies Co., Ltd
* Copyright 2020-2022 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -26,9 +26,9 @@ class MindDataTestPipeline : public UT::DatasetOpTesting {
// Tests for vision C++ API R to Z TensorTransform Operations (in alphabetical order)
/// Feature: RandomLighting
/// Description: test RandomLighting Op on pipeline when alpha=0.1
/// Expectation: the data is processed successfully
/// Feature: RandomLighting op
/// Description: Test RandomLighting Op on pipeline when alpha=0.1
/// Expectation: The data is processed successfully
TEST_F(MindDataTestPipeline, TestRandomLightingPipeline) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRandomLightingPipeline.";
// Create an ImageFolder Dataset
@ -48,11 +48,11 @@ TEST_F(MindDataTestPipeline, TestRandomLightingPipeline) {
auto image = row["image"];
// Create objects for the tensor ops
std::shared_ptr<TensorTransform> randomlighting(new mindspore::dataset::vision::RandomLighting(0.1));
auto randomlighting = std::make_shared<mindspore::dataset::vision::RandomLighting>(0.1);
// Note: No need to check for output after calling API class constructor
// Convert to the same type
std::shared_ptr<TensorTransform> type_cast(new transforms::TypeCast(mindspore::DataType::kNumberTypeUInt8));
auto type_cast = std::make_shared<transforms::TypeCast>(mindspore::DataType::kNumberTypeUInt8);
// Note: No need to check for output after calling API class constructor
ds = ds->Map({randomlighting, type_cast}, {"image"});
@ -73,9 +73,10 @@ TEST_F(MindDataTestPipeline, TestRandomLightingPipeline) {
iter1->Stop();
}
/// Feature: RandomLighting
/// Description: test param check for RandomLighting Op
/// Expectation: get nullptr when params are invalid
/// Feature: RandomLighting op
/// Description: Test param check for RandomLighting Op
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline
/// returns nullptr when params are invalid
TEST_F(MindDataTestPipeline, TestRandomLightingParamCheck) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRandomLightingParamCheck.";
// Create an ImageFolder Dataset
@ -85,7 +86,7 @@ TEST_F(MindDataTestPipeline, TestRandomLightingParamCheck) {
// Case 1: negative alpha
// Create objects for the tensor ops
std::shared_ptr<TensorTransform> random_lighting_op(new mindspore::dataset::vision::RandomLighting(-0.1));
auto random_lighting_op = std::make_shared<mindspore::dataset::vision::RandomLighting>(-0.1);
auto ds2 = ds->Map({random_lighting_op});
EXPECT_NE(ds2, nullptr);
// Create an iterator over the result of the above dataset
@ -94,6 +95,9 @@ TEST_F(MindDataTestPipeline, TestRandomLightingParamCheck) {
EXPECT_EQ(iter2, nullptr);
}
/// Feature: Rescale op
/// Description: Test Rescale op with 1.0 rescale factor and 0.0 shift factor
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestRescaleSucess1) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRescaleSucess1.";
// Create an ImageFolder Dataset
@ -113,11 +117,11 @@ TEST_F(MindDataTestPipeline, TestRescaleSucess1) {
auto image = row["image"];
// Create objects for the tensor ops
std::shared_ptr<TensorTransform> rescale(new mindspore::dataset::vision::Rescale(1.0, 0.0));
auto rescale = std::make_shared<mindspore::dataset::vision::Rescale>(1.0, 0.0);
// Note: No need to check for output after calling API class constructor
// Convert to the same type
std::shared_ptr<TensorTransform> type_cast(new transforms::TypeCast(mindspore::DataType::kNumberTypeUInt8));
auto type_cast = std::make_shared<transforms::TypeCast>(mindspore::DataType::kNumberTypeUInt8);
// Note: No need to check for output after calling API class constructor
ds = ds->Map({rescale, type_cast}, {"image"});
@ -140,6 +144,9 @@ TEST_F(MindDataTestPipeline, TestRescaleSucess1) {
iter1->Stop();
}
/// Feature: Rescale op
/// Description: Test Rescale op with 1.0 / 255 rescale factor and 1.0 shift factor
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestRescaleSucess2) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRescaleSucess2 with different params.";
// Create an ImageFolder Dataset
@ -148,7 +155,7 @@ TEST_F(MindDataTestPipeline, TestRescaleSucess2) {
EXPECT_NE(ds, nullptr);
// Create objects for the tensor ops
std::shared_ptr<TensorTransform> rescale(new mindspore::dataset::vision::Rescale(1.0 / 255, 1.0));
auto rescale = std::make_shared<mindspore::dataset::vision::Rescale>(1.0 / 255, 1.0);
// Note: No need to check for output after calling API class constructor
ds = ds->Map({rescale}, {"image"});
@ -177,6 +184,9 @@ TEST_F(MindDataTestPipeline, TestRescaleSucess2) {
iter->Stop();
}
/// Feature: Resize op
/// Description: Test Resize op with single integer input
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestResize1) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestResize1 with single integer input.";
// Create an ImageFolder Dataset
@ -190,7 +200,7 @@ TEST_F(MindDataTestPipeline, TestResize1) {
EXPECT_NE(ds, nullptr);
// Create resize object with single integer input
std::shared_ptr<TensorTransform> resize_op(new vision::Resize({30}));
auto resize_op = std::make_shared<vision::Resize>(std::vector<int32_t>{30});
// Note: No need to check for output after calling API class constructor
// Create a Map operation on ds
@ -225,6 +235,9 @@ TEST_F(MindDataTestPipeline, TestResize1) {
iter->Stop();
}
/// Feature: ResizeWithBBox op
/// Description: Test ResizeWithBBox op basic usage
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestResizeWithBBoxSuccess) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestResizeWithBBoxSuccess.";
// Create an VOC Dataset
@ -234,8 +247,8 @@ TEST_F(MindDataTestPipeline, TestResizeWithBBoxSuccess) {
EXPECT_NE(ds, nullptr);
// Create objects for the tensor ops
std::shared_ptr<TensorTransform> resize_with_bbox_op(new vision::ResizeWithBBox({30}));
std::shared_ptr<TensorTransform> resize_with_bbox_op1(new vision::ResizeWithBBox({30, 30}));
auto resize_with_bbox_op = std::make_shared<vision::ResizeWithBBox>(std::vector<int32_t>{30});
auto resize_with_bbox_op1 = std::make_shared<vision::ResizeWithBBox>(std::vector<int32_t>{30, 30});
// Note: No need to check for output after calling API class constructor
// Create a Map operation on ds
@ -264,6 +277,9 @@ TEST_F(MindDataTestPipeline, TestResizeWithBBoxSuccess) {
iter->Stop();
}
/// Feature: RGB2GRAY op
/// Description: Test RGB2GRAY op basic usage
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestRGB2GRAYSucess) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRGB2GRAYSucess.";
// Create an ImageFolder Dataset
@ -272,7 +288,7 @@ TEST_F(MindDataTestPipeline, TestRGB2GRAYSucess) {
EXPECT_NE(ds, nullptr);
// Create objects for the tensor ops
std::shared_ptr<TensorTransform> convert(new mindspore::dataset::vision::RGB2GRAY());
auto convert = std::make_shared<mindspore::dataset::vision::RGB2GRAY>();
ds = ds->Map({convert});
EXPECT_NE(ds, nullptr);
@ -300,6 +316,9 @@ TEST_F(MindDataTestPipeline, TestRGB2GRAYSucess) {
iter->Stop();
}
/// Feature: Rotate op
/// Description: Test Rotate op with invalid parameters
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestRotateParamCheck) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRotateParamCheck with invalid parameters.";
// Create an ImageFolder Dataset
@ -309,7 +328,8 @@ TEST_F(MindDataTestPipeline, TestRotateParamCheck) {
// Case 1: Size of center is not 2
// Create objects for the tensor ops
std::shared_ptr<TensorTransform> rotate1(new vision::Rotate(90.0, InterpolationMode::kNearestNeighbour, false, {0.}));
auto rotate1 = std::make_shared<vision::Rotate>(
90.0, InterpolationMode::kNearestNeighbour, false, std::vector<float>{0.});
auto ds2 = ds->Map({rotate1});
EXPECT_NE(ds2, nullptr);
// Create an iterator over the result of the above dataset
@ -319,8 +339,8 @@ TEST_F(MindDataTestPipeline, TestRotateParamCheck) {
// Case 2: Size of fill_value is not 1 or 3
// Create objects for the tensor ops
std::shared_ptr<TensorTransform> rotate2(
new vision::Rotate(-30, InterpolationMode::kNearestNeighbour, false, {1.0, 1.0}, {2, 2}));
auto rotate2 = std::make_shared<vision::Rotate>(
-30, InterpolationMode::kNearestNeighbour, false, std::vector<float>{1.0, 1.0}, std::vector<uint8_t>{2, 2});
auto ds3 = ds->Map({rotate2});
EXPECT_NE(ds3, nullptr);
// Create an iterator over the result of the above dataset
@ -329,6 +349,9 @@ TEST_F(MindDataTestPipeline, TestRotateParamCheck) {
EXPECT_EQ(iter3, nullptr);
}
/// Feature: Rotate op
/// Description: Test Rotate op by passing it to a Map op
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestRotatePass) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRotatePass.";
@ -338,10 +361,10 @@ TEST_F(MindDataTestPipeline, TestRotatePass) {
EXPECT_NE(ds, nullptr);
// Create objects for the tensor ops
std::shared_ptr<TensorTransform> resize(new vision::Resize({50, 25}));
auto resize = std::make_shared<vision::Resize>(std::vector<int32_t>{50, 25});
std::shared_ptr<TensorTransform> rotate(
new vision::Rotate(90, InterpolationMode::kLinear, true, {-1, -1}, {255, 255, 255}));
auto rotate = std::make_shared<vision::Rotate>(
90, InterpolationMode::kLinear, true, std::vector<float>{-1, -1}, std::vector<uint8_t>{255, 255, 255});
// Resize the image to 50 * 25
ds = ds->Map({resize});
@ -381,6 +404,9 @@ TEST_F(MindDataTestPipeline, TestRotatePass) {
iter->Stop();
}
/// Feature: RGB2BGR op
/// Description: Test RGB2BGR op basic usage
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestRGB2BGR) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRGB2BGR.";
// create two imagenet dataset
@ -419,6 +445,9 @@ TEST_F(MindDataTestPipeline, TestRGB2BGR) {
iter2->Stop();
}
/// Feature: RandomEqualize op
/// Description: Test RandomEqualize op basic usage
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestRandomEqualize) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRandomEqualize.";
@ -448,6 +477,9 @@ TEST_F(MindDataTestPipeline, TestRandomEqualize) {
iter->Stop();
}
/// Feature: RandomEqualize op
/// Description: Test RandomEqualize op with invalid prob
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestRandomEqualizeInvalidProb) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRandomEqualizeInvalidProb.";
@ -465,6 +497,9 @@ TEST_F(MindDataTestPipeline, TestRandomEqualizeInvalidProb) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: RandomInvert op
/// Description: Test RandomInvert op basic usage
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestRandomInvert) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRandomInvert.";
@ -494,6 +529,9 @@ TEST_F(MindDataTestPipeline, TestRandomInvert) {
iter->Stop();
}
/// Feature: RandomInvert op
/// Description: Test RandomInvert op with invalid prob
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestRandomInvertInvalidProb) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRandomInvertInvalidProb.";
@ -511,6 +549,9 @@ TEST_F(MindDataTestPipeline, TestRandomInvertInvalidProb) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: RandomAutoContrast op
/// Description: Test RandomAutoContrast op basic usage
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestRandomAutoContrast) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRandomAutoContrast.";
@ -540,6 +581,9 @@ TEST_F(MindDataTestPipeline, TestRandomAutoContrast) {
iter->Stop();
}
/// Feature: RandomAutoContrast op
/// Description: Test RandomAutoContrast op with invalid prob
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestRandomAutoContrastInvalidProb) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRandomAutoContrastInvalidProb.";
@ -557,6 +601,9 @@ TEST_F(MindDataTestPipeline, TestRandomAutoContrastInvalidProb) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: RandomAutoContrast op
/// Description: Test RandomAutoContrast op with invalid cutoff
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestRandomAutoContrastInvalidCutoff) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRandomAutoContrastInvalidCutoff.";
@ -574,6 +621,9 @@ TEST_F(MindDataTestPipeline, TestRandomAutoContrastInvalidCutoff) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: RandomAutoContrast op
/// Description: Test RandomAutoContrast op with invalid ignore
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestRandomAutoContrastInvalidIgnore) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRandomAutoContrastInvalidCutoff.";
@ -591,6 +641,9 @@ TEST_F(MindDataTestPipeline, TestRandomAutoContrastInvalidIgnore) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: RandomAdjustSharpness op
/// Description: Test RandomAdjustSharpness op basic usage
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestRandomAdjustSharpness) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRandomAdjustSharpness.";
@ -621,6 +674,9 @@ TEST_F(MindDataTestPipeline, TestRandomAdjustSharpness) {
iter->Stop();
}
/// Feature: RandomAdjustSharpness op
/// Description: Test RandomAdjustSharpness op with invalid prob
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestRandomAdjustSharpnessInvalidProb) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRandomAdjustSharpnessInvalidProb.";
@ -638,6 +694,9 @@ TEST_F(MindDataTestPipeline, TestRandomAdjustSharpnessInvalidProb) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: RandomAdjustSharpness op
/// Description: Test RandomAdjustSharpness op with invalid degree
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestRandomAdjustSharpnessInvalidDegree) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRandomAdjustSharpnessInvalidProb.";

View File

@ -1,5 +1,5 @@
/**
* Copyright 2020-2021 Huawei Technologies Co., Ltd
* Copyright 2020-2022 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -26,6 +26,9 @@ class MindDataTestPipeline : public UT::DatasetOpTesting {
// Tests for vision C++ API RandomSelectSubpolicy TensorTransform Operations
/// Feature: RandomSelectSubpolicy op
/// Description: Test RandomSelectSubpolicy op defined through shared pointer
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestRandomSelectSubpolicySuccess1Shr) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRandomSelectSubpolicySuccess1Shr.";
@ -37,9 +40,9 @@ TEST_F(MindDataTestPipeline, TestRandomSelectSubpolicySuccess1Shr) {
// Create objects for the tensor ops
// Use shared pointers
// Valid case: TensorTransform is not null and probability is between (0,1)
std::shared_ptr<TensorTransform> invert_op(new vision::Invert());
std::shared_ptr<TensorTransform> equalize_op(new vision::Equalize());
std::shared_ptr<TensorTransform> resize_op(new vision::Resize({15, 15}));
auto invert_op = std::make_shared<vision::Invert>();
auto equalize_op = std::make_shared<vision::Equalize>();
auto resize_op = std::make_shared<vision::Resize>(std::vector<int32_t>{15, 15});
// Prepare input parameters for RandomSelectSubpolicy op
auto invert_pair = std::make_pair(invert_op, 0.5);
@ -48,7 +51,8 @@ TEST_F(MindDataTestPipeline, TestRandomSelectSubpolicySuccess1Shr) {
// Create RandomSelectSubpolicy op
std::vector<std::pair<std::shared_ptr<TensorTransform>, double>> policy = {invert_pair, equalize_pair, resize_pair};
std::shared_ptr<TensorTransform> random_select_subpolicy_op(new vision::RandomSelectSubpolicy({policy}));
auto random_select_subpolicy_op = std::make_shared<vision::RandomSelectSubpolicy>(
std::vector<std::vector<std::pair<std::shared_ptr<TensorTransform>, double>>>{policy});
// Create a Map operation on ds
ds = ds->Map({random_select_subpolicy_op});
@ -77,6 +81,9 @@ TEST_F(MindDataTestPipeline, TestRandomSelectSubpolicySuccess1Shr) {
iter->Stop();
}
/// Feature: RandomSelectSubpolicy op
/// Description: Test RandomSelectSubpolicy op defined through new and auto
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestRandomSelectSubpolicySuccess2Auto) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRandomSelectSubpolicySuccess2Auto.";
@ -136,6 +143,9 @@ TEST_F(MindDataTestPipeline, TestRandomSelectSubpolicySuccess2Auto) {
delete random_select_subpolicy_op;
}
/// Feature: RandomSelectSubpolicy op
/// Description: Test RandomSelectSubpolicy op defined through object definition
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestRandomSelectSubpolicySuccess3Obj) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRandomSelectSubpolicySuccess3Obj.";
@ -187,6 +197,9 @@ TEST_F(MindDataTestPipeline, TestRandomSelectSubpolicySuccess3Obj) {
iter->Stop();
}
/// Feature: RandomSelectSubpolicy op
/// Description: Test RandomSelectSubpolicy op with multiple policies
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestRandomSelectSubpolicySuccess4MultiPolicy) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRandomSelectSubpolicySuccess1MultiPolicy.";
@ -198,9 +211,9 @@ TEST_F(MindDataTestPipeline, TestRandomSelectSubpolicySuccess4MultiPolicy) {
// Create objects for the tensor ops
// Tensor transform ops have shared pointers
// Valid case: TensorTransform is not null and probability is between (0,1)
std::shared_ptr<TensorTransform> invert_op(new vision::Invert());
std::shared_ptr<TensorTransform> equalize_op(new vision::Equalize());
std::shared_ptr<TensorTransform> resize_op(new vision::Resize({15, 15}));
auto invert_op = std::make_shared<vision::Invert>();
auto equalize_op = std::make_shared<vision::Equalize>();
auto resize_op = std::make_shared<vision::Resize>(std::vector<int32_t>{15, 15});
// Prepare input parameters for RandomSelectSubpolicy op
auto invert_pair = std::make_pair(invert_op, 0.75);
@ -210,7 +223,8 @@ TEST_F(MindDataTestPipeline, TestRandomSelectSubpolicySuccess4MultiPolicy) {
// Create RandomSelectSubpolicy op with 2 policies
std::vector<std::pair<std::shared_ptr<TensorTransform>, double>> policy1 = {resize_pair, invert_pair};
std::vector<std::pair<std::shared_ptr<TensorTransform>, double>> policy2 = {equalize_pair};
std::shared_ptr<TensorTransform> random_select_subpolicy_op(new vision::RandomSelectSubpolicy({policy1, policy2}));
auto random_select_subpolicy_op = std::make_shared<vision::RandomSelectSubpolicy>(
std::vector<std::vector<std::pair<std::shared_ptr<TensorTransform>, double>>>{policy1, policy2});
// Create a Map operation on ds
ds = ds->Map({random_select_subpolicy_op});
@ -239,6 +253,9 @@ TEST_F(MindDataTestPipeline, TestRandomSelectSubpolicySuccess4MultiPolicy) {
iter->Stop();
}
/// Feature: RandomSelectSubpolicy op
/// Description: Test RandomSelectSubpolicy op with which policy contains an invalid subpolicy (prob out of bounds)
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestRandomSelectSubpolicyFail1) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRandomSelectSubpolicyFail1.";
@ -248,9 +265,9 @@ TEST_F(MindDataTestPipeline, TestRandomSelectSubpolicyFail1) {
EXPECT_NE(ds, nullptr);
// Create objects for the tensor ops
std::shared_ptr<TensorTransform> invert_op(new vision::Invert());
std::shared_ptr<TensorTransform> equalize_op(new vision::Equalize());
std::shared_ptr<TensorTransform> resize_op(new vision::Resize({15, 15}));
auto invert_op = std::make_shared<vision::Invert>();
auto equalize_op = std::make_shared<vision::Equalize>();
auto resize_op = std::make_shared<vision::Resize>(std::vector<int32_t>{15, 15});
// Prepare input parameters for RandomSelectSubpolicy op
// For RandomSelectSubpolicy : probability of transform must be between 0.0 and 1.0
@ -261,7 +278,8 @@ TEST_F(MindDataTestPipeline, TestRandomSelectSubpolicyFail1) {
// Create RandomSelectSubpolicy op
std::vector<std::pair<std::shared_ptr<TensorTransform>, double>> policy = {invert_pair, equalize_pair, resize_pair};
std::shared_ptr<TensorTransform> random_select_subpolicy_op(new vision::RandomSelectSubpolicy({policy}));
auto random_select_subpolicy_op = std::make_shared<vision::RandomSelectSubpolicy>(
std::vector<std::vector<std::pair<std::shared_ptr<TensorTransform>, double>>>{policy});
// Create a Map operation on ds
ds = ds->Map({random_select_subpolicy_op});
@ -273,6 +291,9 @@ TEST_F(MindDataTestPipeline, TestRandomSelectSubpolicyFail1) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: RandomSelectSubpolicy op
/// Description: Test RandomSelectSubpolicy op with an invalid empty subpolicy
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestRandomSelectSubpolicyFail2) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRandomSelectSubpolicyFail2.";
@ -283,7 +304,8 @@ TEST_F(MindDataTestPipeline, TestRandomSelectSubpolicyFail2) {
// Create RandomSelectSubpolicy op with invalid empty subpolicy
std::vector<std::pair<std::shared_ptr<TensorTransform>, double>> policy = {};
std::shared_ptr<TensorTransform> random_select_subpolicy_op(new vision::RandomSelectSubpolicy({policy}));
auto random_select_subpolicy_op = std::make_shared<vision::RandomSelectSubpolicy>(
std::vector<std::vector<std::pair<std::shared_ptr<TensorTransform>, double>>>{policy});
// Create a Map operation on ds
ds = ds->Map({random_select_subpolicy_op});
@ -295,6 +317,9 @@ TEST_F(MindDataTestPipeline, TestRandomSelectSubpolicyFail2) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: RandomSelectSubpolicy op
/// Description: Test RandomSelectSubpolicy op with policy that contains a nullptr subpolicy
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestRandomSelectSubpolicyFail3) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRandomSelectSubpolicyFail3.";
@ -304,9 +329,9 @@ TEST_F(MindDataTestPipeline, TestRandomSelectSubpolicyFail3) {
EXPECT_NE(ds, nullptr);
// Create objects for the tensor ops
std::shared_ptr<TensorTransform> invert_op(new vision::Invert());
std::shared_ptr<TensorTransform> equalize_op(new vision::Equalize());
std::shared_ptr<TensorTransform> resize_op(new vision::Resize({15, 15}));
auto invert_op = std::make_shared<vision::Invert>();
auto equalize_op = std::make_shared<vision::Equalize>();
auto resize_op = std::make_shared<vision::Resize>(std::vector<int32_t>{15, 15});
// Prepare input parameters for RandomSelectSubpolicy op
auto invert_pair = std::make_pair(invert_op, 0.5);
@ -319,7 +344,8 @@ TEST_F(MindDataTestPipeline, TestRandomSelectSubpolicyFail3) {
// Create RandomSelectSubpolicy op with invalid nullptr pair
std::vector<std::pair<std::shared_ptr<TensorTransform>, double>> policy = {invert_pair, dummy_pair, equalize_pair,
resize_pair};
std::shared_ptr<TensorTransform> random_select_subpolicy_op(new vision::RandomSelectSubpolicy({policy}));
auto random_select_subpolicy_op = std::make_shared<vision::RandomSelectSubpolicy>(
std::vector<std::vector<std::pair<std::shared_ptr<TensorTransform>, double>>>{policy});
// Create a Map operation on ds
ds = ds->Map({random_select_subpolicy_op});
@ -331,6 +357,9 @@ TEST_F(MindDataTestPipeline, TestRandomSelectSubpolicyFail3) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: RandomSelectSubpolicy op
/// Description: Test RandomSelectSubpolicy op with invalid transform op within a subpolicy
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestRandomSelectSubpolicyFail4) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRandomSelectSubpolicyFail4.";
@ -341,14 +370,15 @@ TEST_F(MindDataTestPipeline, TestRandomSelectSubpolicyFail4) {
// Create objects for the tensor ops
// Create RandomVerticalFlip op with invalid negative input
std::shared_ptr<TensorTransform> vertflip_op(new vision::RandomVerticalFlip(-2.0));
auto vertflip_op = std::make_shared<vision::RandomVerticalFlip>(-2.0);
// Prepare input parameters for RandomSelectSubpolicy op
auto vertflip_pair = std::make_pair(vertflip_op, 1);
// Create RandomSelectSubpolicy op with invalid transform op within a subpolicy
std::vector<std::pair<std::shared_ptr<TensorTransform>, double>> policy = {vertflip_pair};
std::shared_ptr<TensorTransform> random_select_subpolicy_op(new vision::RandomSelectSubpolicy({policy}));
auto random_select_subpolicy_op = std::make_shared<vision::RandomSelectSubpolicy>(
std::vector<std::vector<std::pair<std::shared_ptr<TensorTransform>, double>>>{policy});
// Create a Map operation on ds
ds = ds->Map({random_select_subpolicy_op});

View File

@ -1,5 +1,5 @@
/**
* Copyright 2020-2021 Huawei Technologies Co., Ltd
* Copyright 2020-2022 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -28,6 +28,9 @@ class MindDataTestPipeline : public UT::DatasetOpTesting {
// Tests for vision C++ API Random* TensorTransform Operations (in alphabetical order)
/// Feature: RandomAffine op
/// Description: Test RandomAffine op with invalid parameters
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestRandomAffineFail) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRandomAffineFail with invalid parameters.";
// Create an ImageFolder Dataset
@ -37,7 +40,7 @@ TEST_F(MindDataTestPipeline, TestRandomAffineFail) {
// Case 1: Empty input for translate
// Create objects for the tensor ops
std::shared_ptr<TensorTransform> affine1(new vision::RandomAffine({0.0, 0.0}, {}));
auto affine1 = std::make_shared<vision::RandomAffine>(std::vector<float_t>{0.0, 0.0}, std::vector<float_t>{});
auto ds1 = ds->Map({affine1});
EXPECT_NE(ds1, nullptr);
// Create an iterator over the result of the above dataset
@ -47,7 +50,8 @@ TEST_F(MindDataTestPipeline, TestRandomAffineFail) {
// Case 2: Invalid number of values for translate
// Create objects for the tensor ops
std::shared_ptr<TensorTransform> affine2(new vision::RandomAffine({0.0, 0.0}, {1, 1, 1, 1, 1}));
auto affine2 = std::make_shared<vision::RandomAffine>(
std::vector<float_t>{0.0, 0.0}, std::vector<float_t>{1, 1, 1, 1, 1});
auto ds2 = ds->Map({affine2});
EXPECT_NE(ds2, nullptr);
// Create an iterator over the result of the above dataset
@ -57,7 +61,9 @@ TEST_F(MindDataTestPipeline, TestRandomAffineFail) {
// Case 3: Invalid number of values for shear
// Create objects for the tensor ops
std::shared_ptr<TensorTransform> affine3(new vision::RandomAffine({30.0, 30.0}, {0.0, 0.0}, {2.0, 2.0}, {10.0}));
auto affine3 = std::make_shared<vision::RandomAffine>(
std::vector<float_t>{30.0, 30.0}, std::vector<float_t>{0.0, 0.0}, std::vector<float_t>{2.0, 2.0},
std::vector<float_t>{10.0});
auto ds3 = ds->Map({affine3});
EXPECT_NE(ds3, nullptr);
// Create an iterator over the result of the above dataset
@ -66,6 +72,9 @@ TEST_F(MindDataTestPipeline, TestRandomAffineFail) {
EXPECT_EQ(iter3, nullptr);
}
/// Feature: RandomAffine op
/// Description: Test RandomAffine op with non-default parameters
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestRandomAffineSuccess1) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRandomAffineSuccess1 with non-default parameters.";
@ -80,8 +89,9 @@ TEST_F(MindDataTestPipeline, TestRandomAffineSuccess1) {
EXPECT_NE(ds, nullptr);
// Create objects for the tensor ops
std::shared_ptr<TensorTransform> affine(
new vision::RandomAffine({30.0, 30.0}, {-1.0, 1.0, -1.0, 1.0}, {2.0, 2.0}, {10.0, 10.0, 20.0, 20.0}));
auto affine = std::make_shared<vision::RandomAffine>(
std::vector<float>{30.0, 30.0}, std::vector<float>{-1.0, 1.0, -1.0, 1.0}, std::vector<float>{2.0, 2.0},
std::vector<float>{10.0, 10.0, 20.0, 20.0});
// Create a Map operation on ds
ds = ds->Map({affine});
@ -115,6 +125,9 @@ TEST_F(MindDataTestPipeline, TestRandomAffineSuccess1) {
iter->Stop();
}
/// Feature: RandomAffine op
/// Description: Test RandomAffine op with default parameters
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestRandomAffineSuccess2) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRandomAffineSuccess2 with default parameters.";
@ -129,7 +142,7 @@ TEST_F(MindDataTestPipeline, TestRandomAffineSuccess2) {
EXPECT_NE(ds, nullptr);
// Create objects for the tensor ops
std::shared_ptr<TensorTransform> affine(new vision::RandomAffine({0.0, 0.0}));
auto affine = std::make_shared<vision::RandomAffine>(std::vector<float_t>{0.0, 0.0});
// Create a Map operation on ds
ds = ds->Map({affine});
@ -163,6 +176,9 @@ TEST_F(MindDataTestPipeline, TestRandomAffineSuccess2) {
iter->Stop();
}
/// Feature: RandomColor op
/// Description: Test RandomColor op with non-default parameters
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestRandomColor) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRandomColor with non-default parameters.";
@ -215,6 +231,9 @@ TEST_F(MindDataTestPipeline, TestRandomColor) {
iter->Stop();
}
/// Feature: RandomColorAdjust op
/// Description: Test RandomColorAdjust op with non-default parameters
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestRandomColorAdjust) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRandomColorAdjust.";
@ -230,21 +249,25 @@ TEST_F(MindDataTestPipeline, TestRandomColorAdjust) {
// Create objects for the tensor ops
// Use single value for vectors
std::shared_ptr<TensorTransform> random_color_adjust1(new vision::RandomColorAdjust({1.0}, {0.0}, {0.5}, {0.5}));
auto random_color_adjust1 = std::make_shared<vision::RandomColorAdjust>(
std::vector<float>{1.0}, std::vector<float>{0.0}, std::vector<float>{0.5}, std::vector<float>{0.5});
// Use same 2 values for vectors
std::shared_ptr<TensorTransform> random_color_adjust2(
new vision::RandomColorAdjust({1.0, 1.0}, {0.0, 0.0}, {0.5, 0.5}, {0.5, 0.5}));
auto random_color_adjust2 = std::make_shared<vision::RandomColorAdjust>(
std::vector<float>{1.0, 1.0}, std::vector<float>{0.0, 0.0},
std::vector<float>{0.5, 0.5}, std::vector<float>{0.5, 0.5});
// Use different 2 value for vectors
std::shared_ptr<TensorTransform> random_color_adjust3(
new vision::RandomColorAdjust({0.5, 1.0}, {0.0, 0.5}, {0.25, 0.5}, {0.25, 0.5}));
auto random_color_adjust3 = std::make_shared<vision::RandomColorAdjust>(
std::vector<float>{0.5, 1.0}, std::vector<float>{0.0, 0.5},
std::vector<float>{0.25, 0.5}, std::vector<float>{0.25, 0.5});
// Use default input values
std::shared_ptr<TensorTransform> random_color_adjust4(new vision::RandomColorAdjust());
auto random_color_adjust4 = std::make_shared<vision::RandomColorAdjust>();
// Use subset of explicitly set parameters
std::shared_ptr<TensorTransform> random_color_adjust5(new vision::RandomColorAdjust({0.0, 0.5}, {0.25}));
auto random_color_adjust5 = std::make_shared<vision::RandomColorAdjust>(
std::vector<float>{0.0, 0.5}, std::vector<float>{0.25});
// Create a Map operation on ds
ds = ds->Map(
@ -279,6 +302,9 @@ TEST_F(MindDataTestPipeline, TestRandomColorAdjust) {
iter->Stop();
}
/// Feature: RandomCrop op
/// Description: Test RandomCrop op with various size of size vector, padding vector, and fill_value vector
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestRandomCropSuccess) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRandomCropSuccess.";
// Create an VOC Dataset
@ -289,25 +315,30 @@ TEST_F(MindDataTestPipeline, TestRandomCropSuccess) {
// Create objects for the tensor ops
// Testing size of size vector is 1
std::shared_ptr<TensorTransform> random_crop(new vision::RandomCrop({20}));
auto random_crop = std::make_shared<vision::RandomCrop>(std::vector<int32_t>{20});
// Testing size of size vector is 2
std::shared_ptr<TensorTransform> random_crop1(new vision::RandomCrop({20, 20}));
auto random_crop1 = std::make_shared<vision::RandomCrop>(std::vector<int32_t>{20, 20});
// Testing size of paddiing vector is 1
std::shared_ptr<TensorTransform> random_crop2(new vision::RandomCrop({20, 20}, {10}));
auto random_crop2 = std::make_shared<vision::RandomCrop>(
std::vector<int32_t>{20, 20}, std::vector<int32_t>{10});
// Testing size of paddiing vector is 2
std::shared_ptr<TensorTransform> random_crop3(new vision::RandomCrop({20, 20}, {10, 20}));
auto random_crop3 = std::make_shared<vision::RandomCrop>(
std::vector<int32_t>{20, 20}, std::vector<int32_t>{10, 20});
// Testing size of paddiing vector is 2
std::shared_ptr<TensorTransform> random_crop4(new vision::RandomCrop({20, 20}, {10, 10, 10, 10}));
auto random_crop4 = std::make_shared<vision::RandomCrop>(
std::vector<int32_t>{20, 20}, std::vector<int32_t>{10, 10, 10, 10});
// Testing size of fill_value vector is 1
std::shared_ptr<TensorTransform> random_crop5(new vision::RandomCrop({20, 20}, {10, 10, 10, 10}, false, {5}));
auto random_crop5 = std::make_shared<vision::RandomCrop>(
std::vector<int32_t>{20, 20}, std::vector<int32_t>{10, 10, 10, 10}, false, std::vector<uint8_t>{5});
// Testing size of fill_value vector is 3
std::shared_ptr<TensorTransform> random_crop6(new vision::RandomCrop({20, 20}, {10, 10, 10, 10}, false, {4, 4, 4}));
auto random_crop6 = std::make_shared<vision::RandomCrop>(
std::vector<int32_t>{20, 20}, std::vector<int32_t>{10, 10, 10, 10}, false, std::vector<uint8_t>{4, 4, 4});
// Create a Map operation on ds
ds = ds->Map({random_crop, random_crop1, random_crop2, random_crop3, random_crop4, random_crop5, random_crop6},
@ -336,6 +367,9 @@ TEST_F(MindDataTestPipeline, TestRandomCropSuccess) {
iter->Stop();
}
/// Feature: RandomCrop op
/// Description: Test RandomCrop op with multiple fields
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestRandomCropWithMultiField) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRandomCropWithMultiField.";
// Create an VOC Dataset
@ -346,7 +380,7 @@ TEST_F(MindDataTestPipeline, TestRandomCropWithMultiField) {
// Create objects for the tensor ops
transforms::Duplicate duplicate = transforms::Duplicate();
std::shared_ptr<TensorTransform> random_crop(new mindspore::dataset::vision::RandomCrop({500, 500}));
auto random_crop = std::make_shared<mindspore::dataset::vision::RandomCrop>(std::vector<int32_t>{500, 500});
// Create a Map operation on ds
ds = ds->Map({duplicate}, {"image"}, {"image", "image_copy"});
@ -379,6 +413,9 @@ TEST_F(MindDataTestPipeline, TestRandomCropWithMultiField) {
iter->Stop();
}
/// Feature: RandomCrop op
/// Description: Test RandomCrop op with invalid parameters
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestRandomCropFail) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRandomCropFail with invalid parameters.";
// Create an VOC Dataset
@ -389,7 +426,7 @@ TEST_F(MindDataTestPipeline, TestRandomCropFail) {
// Case 1: Testing the size parameter is negative.
// Create objects for the tensor ops
std::shared_ptr<TensorTransform> random_crop1(new vision::RandomCrop({-28, 28}));
auto random_crop1 = std::make_shared<vision::RandomCrop>(std::vector<int32_t>{-28, 28});
auto ds1 = ds->Map({random_crop1});
EXPECT_NE(ds1, nullptr);
// Create an iterator over the result of the above dataset
@ -399,7 +436,7 @@ TEST_F(MindDataTestPipeline, TestRandomCropFail) {
// Case 2: Testing the size parameter is None.
// Create objects for the tensor ops
std::shared_ptr<TensorTransform> random_crop2(new vision::RandomCrop({}));
auto random_crop2 = std::make_shared<vision::RandomCrop>(std::vector<int32_t>{});
auto ds2 = ds->Map({random_crop2});
EXPECT_NE(ds2, nullptr);
// Create an iterator over the result of the above dataset
@ -409,7 +446,7 @@ TEST_F(MindDataTestPipeline, TestRandomCropFail) {
// Case 3: Testing the size of size vector is 3.
// Create objects for the tensor ops
std::shared_ptr<TensorTransform> random_crop3(new vision::RandomCrop({28, 28, 28}));
auto random_crop3 = std::make_shared<vision::RandomCrop>(std::vector<int32_t>{28, 28, 28});
auto ds3 = ds->Map({random_crop3});
EXPECT_NE(ds3, nullptr);
// Create an iterator over the result of the above dataset
@ -419,7 +456,8 @@ TEST_F(MindDataTestPipeline, TestRandomCropFail) {
// Case 4: Testing the padding parameter is negative.
// Create objects for the tensor ops
std::shared_ptr<TensorTransform> random_crop4(new vision::RandomCrop({28, 28}, {-5}));
auto random_crop4 = std::make_shared<vision::RandomCrop>(
std::vector<int32_t>{28, 28}, std::vector<int32_t>{-5});
auto ds4 = ds->Map({random_crop4});
EXPECT_NE(ds4, nullptr);
// Create an iterator over the result of the above dataset
@ -429,7 +467,8 @@ TEST_F(MindDataTestPipeline, TestRandomCropFail) {
// Case 5: Testing the size of padding vector is empty.
// Create objects for the tensor ops
std::shared_ptr<TensorTransform> random_crop5(new vision::RandomCrop({28, 28}, {}));
auto random_crop5 = std::make_shared<vision::RandomCrop>(
std::vector<int32_t>{28, 28}, std::vector<int32_t>{});
auto ds5 = ds->Map({random_crop5});
EXPECT_NE(ds5, nullptr);
// Create an iterator over the result of the above dataset
@ -439,7 +478,8 @@ TEST_F(MindDataTestPipeline, TestRandomCropFail) {
// Case 6: Testing the size of padding vector is 3.
// Create objects for the tensor ops
std::shared_ptr<TensorTransform> random_crop6(new vision::RandomCrop({28, 28}, {5, 5, 5}));
auto random_crop6 = std::make_shared<vision::RandomCrop>(
std::vector<int32_t>{28, 28}, std::vector<int32_t>{5, 5, 5});
auto ds6 = ds->Map({random_crop6});
EXPECT_NE(ds6, nullptr);
// Create an iterator over the result of the above dataset
@ -449,7 +489,8 @@ TEST_F(MindDataTestPipeline, TestRandomCropFail) {
// Case 7: Testing the size of padding vector is 5.
// Create objects for the tensor ops
std::shared_ptr<TensorTransform> random_crop7(new vision::RandomCrop({28, 28}, {5, 5, 5, 5, 5}));
auto random_crop7 = std::make_shared<vision::RandomCrop>(
std::vector<int32_t>{28, 28}, std::vector<int32_t>{5, 5, 5, 5, 5});
auto ds7 = ds->Map({random_crop7});
EXPECT_NE(ds7, nullptr);
// Create an iterator over the result of the above dataset
@ -459,7 +500,8 @@ TEST_F(MindDataTestPipeline, TestRandomCropFail) {
// Case 8: Testing the size of fill_value vector is empty.
// Create objects for the tensor ops
std::shared_ptr<TensorTransform> random_crop8(new vision::RandomCrop({28, 28}, {0, 0, 0, 0}, false, {}));
auto random_crop8 = std::make_shared<vision::RandomCrop>(
std::vector<int32_t>{28, 28}, std::vector<int32_t>{0, 0, 0, 0}, false, std::vector<uint8_t>{});
auto ds8 = ds->Map({random_crop8});
EXPECT_NE(ds8, nullptr);
// Create an iterator over the result of the above dataset
@ -469,7 +511,8 @@ TEST_F(MindDataTestPipeline, TestRandomCropFail) {
// Case 9: Testing the size of fill_value vector is 2.
// Create objects for the tensor ops
std::shared_ptr<TensorTransform> random_crop9(new vision::RandomCrop({28, 28}, {0, 0, 0, 0}, false, {0, 0}));
auto random_crop9 = std::make_shared<vision::RandomCrop>(
std::vector<int32_t>{28, 28}, std::vector<int32_t>{0, 0, 0, 0}, false, std::vector<uint8_t>{0, 0});
auto ds9 = ds->Map({random_crop9});
EXPECT_NE(ds9, nullptr);
// Create an iterator over the result of the above dataset
@ -479,7 +522,8 @@ TEST_F(MindDataTestPipeline, TestRandomCropFail) {
// Case 10: Testing the size of fill_value vector is 4.
// Create objects for the tensor ops
std::shared_ptr<TensorTransform> random_crop10(new vision::RandomCrop({28, 28}, {0, 0, 0, 0}, false, {0, 0, 0, 0}));
auto random_crop10 = std::make_shared<vision::RandomCrop>(
std::vector<int32_t>{28, 28}, std::vector<int32_t>{0, 0, 0, 0}, false, std::vector<uint8_t>{0, 0, 0, 0});
auto ds10 = ds->Map({random_crop10});
EXPECT_NE(ds10, nullptr);
// Create an iterator over the result of the above dataset
@ -488,6 +532,9 @@ TEST_F(MindDataTestPipeline, TestRandomCropFail) {
EXPECT_EQ(iter10, nullptr);
}
/// Feature: RandomCropWithBBox op
/// Description: Test RandomCropWithBBox op basic usage
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestRandomCropWithBboxSuccess) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRandomCropWithBboxSuccess.";
// Create an VOC Dataset
@ -497,7 +544,8 @@ TEST_F(MindDataTestPipeline, TestRandomCropWithBboxSuccess) {
EXPECT_NE(ds, nullptr);
// Create objects for the tensor ops
std::shared_ptr<TensorTransform> random_crop(new mindspore::dataset::vision::RandomCropWithBBox({128, 128}));
auto random_crop = std::make_shared<mindspore::dataset::vision::RandomCropWithBBox>(
std::vector<int32_t>{128, 128});
// Create a Map operation on ds
ds = ds->Map({random_crop}, {"image", "bbox"}, {"image", "bbox"}, {"image", "bbox"});
@ -527,6 +575,9 @@ TEST_F(MindDataTestPipeline, TestRandomCropWithBboxSuccess) {
iter->Stop();
}
/// Feature: RandomCropWithBBox op
/// Description: Test RandomCropWithBBox op with invalid parameters
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestRandomCropWithBboxFail) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRandomCropWithBboxFail with invalid parameters.";
// Create an VOC Dataset
@ -537,7 +588,7 @@ TEST_F(MindDataTestPipeline, TestRandomCropWithBboxFail) {
// Case 1: The size parameter is negative.
// Create objects for the tensor ops
std::shared_ptr<TensorTransform> random_crop1(new vision::RandomCropWithBBox({-10}));
auto random_crop1 = std::make_shared<vision::RandomCropWithBBox>(std::vector<int32_t>{-10});
auto ds1 = ds->Map({random_crop1});
EXPECT_NE(ds1, nullptr);
// Create an iterator over the result of the above dataset
@ -547,7 +598,8 @@ TEST_F(MindDataTestPipeline, TestRandomCropWithBboxFail) {
// Case 2: The parameter in the padding vector is negative.
// Create objects for the tensor ops
std::shared_ptr<TensorTransform> random_crop2(new vision::RandomCropWithBBox({10, 10}, {-2, 2, 2, 2}));
auto random_crop2 = std::make_shared<vision::RandomCropWithBBox>(
std::vector<int32_t>{10, 10}, std::vector<int32_t>{-2, 2, 2, 2});
auto ds2 = ds->Map({random_crop2});
EXPECT_NE(ds2, nullptr);
// Create an iterator over the result of the above dataset
@ -557,7 +609,7 @@ TEST_F(MindDataTestPipeline, TestRandomCropWithBboxFail) {
// Case 3: The size container is empty.
// Create objects for the tensor ops
std::shared_ptr<TensorTransform> random_crop3(new vision::RandomCropWithBBox({}));
auto random_crop3 = std::make_shared<vision::RandomCropWithBBox>(std::vector<int32_t>{});
auto ds3 = ds->Map({random_crop3});
EXPECT_NE(ds3, nullptr);
// Create an iterator over the result of the above dataset
@ -567,7 +619,7 @@ TEST_F(MindDataTestPipeline, TestRandomCropWithBboxFail) {
// Case 4: The size of the size container is too large.
// Create objects for the tensor ops
std::shared_ptr<TensorTransform> random_crop4(new vision::RandomCropWithBBox({10, 10, 10}));
auto random_crop4 = std::make_shared<vision::RandomCropWithBBox>(std::vector<int32_t>{10, 10, 10});
auto ds4 = ds->Map({random_crop4});
EXPECT_NE(ds4, nullptr);
// Create an iterator over the result of the above dataset
@ -577,7 +629,8 @@ TEST_F(MindDataTestPipeline, TestRandomCropWithBboxFail) {
// Case 5: The padding container is empty.
// Create objects for the tensor ops
std::shared_ptr<TensorTransform> random_crop5(new vision::RandomCropWithBBox({10, 10}, {}));
auto random_crop5 = std::make_shared<vision::RandomCropWithBBox>(
std::vector<int32_t>{10, 10}, std::vector<int32_t>{});
auto ds5 = ds->Map({random_crop5});
EXPECT_NE(ds5, nullptr);
// Create an iterator over the result of the above dataset
@ -587,7 +640,8 @@ TEST_F(MindDataTestPipeline, TestRandomCropWithBboxFail) {
// Case 6: The size of the padding container is too large.
// Create objects for the tensor ops
std::shared_ptr<TensorTransform> random_crop6(new vision::RandomCropWithBBox({10, 10}, {5, 5, 5, 5, 5}));
auto random_crop6 = std::make_shared<vision::RandomCropWithBBox>(
std::vector<int32_t>{10, 10}, std::vector<int32_t>{5, 5, 5, 5, 5});
auto ds6 = ds->Map({random_crop6});
EXPECT_NE(ds6, nullptr);
// Create an iterator over the result of the above dataset
@ -597,7 +651,8 @@ TEST_F(MindDataTestPipeline, TestRandomCropWithBboxFail) {
// Case 7: The fill_value container is empty.
// Create objects for the tensor ops
std::shared_ptr<TensorTransform> random_crop7(new vision::RandomCropWithBBox({10, 10}, {5, 5, 5, 5}, false, {}));
auto random_crop7 = std::make_shared<vision::RandomCropWithBBox>(
std::vector<int32_t>{10, 10}, std::vector<int32_t>{5, 5, 5, 5}, false, std::vector<uint8_t>{});
auto ds7 = ds->Map({random_crop7});
EXPECT_NE(ds7, nullptr);
// Create an iterator over the result of the above dataset
@ -607,8 +662,8 @@ TEST_F(MindDataTestPipeline, TestRandomCropWithBboxFail) {
// Case 8: The size of the fill_value container is too large.
// Create objects for the tensor ops
std::shared_ptr<TensorTransform> random_crop8(
new vision::RandomCropWithBBox({10, 10}, {5, 5, 5, 5}, false, {3, 3, 3, 3}));
auto random_crop8 = std::make_shared<vision::RandomCropWithBBox>(
std::vector<int32_t>{10, 10}, std::vector<int32_t>{5, 5, 5, 5}, false, std::vector<uint8_t>{3, 3, 3, 3});
auto ds8 = ds->Map({random_crop8});
EXPECT_NE(ds8, nullptr);
// Create an iterator over the result of the above dataset
@ -617,6 +672,9 @@ TEST_F(MindDataTestPipeline, TestRandomCropWithBboxFail) {
EXPECT_EQ(iter8, nullptr);
}
/// Feature: RandomHorizontalFlipWithBBox op
/// Description: Test RandomHorizontalFlipWithBBox op basic usage
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestRandomHorizontalFlipWithBBoxSuccess) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRandomHorizontalFlipWithBBoxSuccess.";
// Create an VOC Dataset
@ -655,6 +713,9 @@ TEST_F(MindDataTestPipeline, TestRandomHorizontalFlipWithBBoxSuccess) {
iter->Stop();
}
/// Feature: RandomHorizontalFlip and RandomVerticalFlip ops
/// Description: Test RandomVerticalFlip op then RandomHorizontalFlip op on ImageFolderDataset
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestRandomHorizontalAndVerticalFlip) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRandomHorizontalAndVerticalFlip for horizontal and vertical flips.";
@ -704,6 +765,9 @@ TEST_F(MindDataTestPipeline, TestRandomHorizontalAndVerticalFlip) {
iter->Stop();
}
/// Feature: RandomResize op
/// Description: Test RandomResize with single integer input with multiple fields
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestRandomResizeWithMultiField) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRandomResizeWithMultiField with single integer input.";
@ -714,7 +778,7 @@ TEST_F(MindDataTestPipeline, TestRandomResizeWithMultiField) {
// Create objects for the tensor ops
transforms::Duplicate duplicate = transforms::Duplicate();
std::shared_ptr<TensorTransform> random_resize(new vision::RandomResize({100}));
auto random_resize = std::make_shared<vision::RandomResize>(std::vector<int32_t>{100});
// Create a Map operation on ds
ds = ds->Map({duplicate}, {"image"}, {"image", "image_copy"});
@ -748,6 +812,9 @@ TEST_F(MindDataTestPipeline, TestRandomResizeWithMultiField) {
iter->Stop();
}
/// Feature: RandomPosterize op
/// Description: Test RandomPosterize op with non-default parameters
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestRandomPosterizeSuccess1) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRandomPosterizeSuccess1 with non-default parameters.";
@ -762,7 +829,7 @@ TEST_F(MindDataTestPipeline, TestRandomPosterizeSuccess1) {
EXPECT_NE(ds, nullptr);
// Create objects for the tensor ops
std::shared_ptr<TensorTransform> posterize(new vision::RandomPosterize({1, 4}));
auto posterize = std::make_shared<vision::RandomPosterize>(std::vector<uint8_t>{1, 4});
// Create a Map operation on ds
ds = ds->Map({posterize});
@ -796,6 +863,9 @@ TEST_F(MindDataTestPipeline, TestRandomPosterizeSuccess1) {
iter->Stop();
}
/// Feature: RandomPosterize op
/// Description: Test RandomPosterize op with default parameters
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestRandomPosterizeSuccess2) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRandomPosterizeSuccess2 with default parameters.";
@ -810,7 +880,7 @@ TEST_F(MindDataTestPipeline, TestRandomPosterizeSuccess2) {
EXPECT_NE(ds, nullptr);
// Create objects for the tensor ops
std::shared_ptr<TensorTransform> posterize(new vision::RandomPosterize());
auto posterize = std::make_shared<vision::RandomPosterize>();
// Create a Map operation on ds
ds = ds->Map({posterize});
@ -844,6 +914,9 @@ TEST_F(MindDataTestPipeline, TestRandomPosterizeSuccess2) {
iter->Stop();
}
/// Feature: RandomResize op
/// Description: Test RandomResize op with single integer input
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestRandomResizeSuccess1) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRandomResizeSuccess1 with single integer input.";
@ -853,7 +926,7 @@ TEST_F(MindDataTestPipeline, TestRandomResizeSuccess1) {
EXPECT_NE(ds, nullptr);
// Create objects for the tensor ops
std::shared_ptr<TensorTransform> random_resize(new vision::RandomResize({66}));
auto random_resize = std::make_shared<vision::RandomResize>(std::vector<int32_t>{66});
// Create a Map operation on ds
ds = ds->Map({random_resize}, {"image"});
@ -883,6 +956,9 @@ TEST_F(MindDataTestPipeline, TestRandomResizeSuccess1) {
iter->Stop();
}
/// Feature: RandomResize op
/// Description: Test RandomResize op with (height, width) input
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestRandomResizeSuccess2) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRandomResizeSuccess2 with (height, width) input.";
@ -897,7 +973,7 @@ TEST_F(MindDataTestPipeline, TestRandomResizeSuccess2) {
EXPECT_NE(ds, nullptr);
// Create objects for the tensor ops
std::shared_ptr<TensorTransform> random_resize(new vision::RandomResize({66, 77}));
auto random_resize = std::make_shared<vision::RandomResize>(std::vector<int32_t>{66, 77});
// Create a Map operation on ds
ds = ds->Map({random_resize}, {"image"});
@ -927,6 +1003,9 @@ TEST_F(MindDataTestPipeline, TestRandomResizeSuccess2) {
iter->Stop();
}
/// Feature: RandomResizeWithBBox op
/// Description: Test RandomResizeWithBBox op with single integer input
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestRandomResizeWithBBoxSuccess1) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRandomResizeWithBBoxSuccess1 with single integer input.";
// setting seed here to prevent random core dump
@ -940,7 +1019,7 @@ TEST_F(MindDataTestPipeline, TestRandomResizeWithBBoxSuccess1) {
EXPECT_NE(ds, nullptr);
// Create objects for the tensor ops
std::shared_ptr<TensorTransform> random_resize(new vision::RandomResizeWithBBox({88}));
auto random_resize = std::make_shared<vision::RandomResizeWithBBox>(std::vector<int32_t>{88});
// Create a Map operation on ds
ds = ds->Map({random_resize}, {"image", "bbox"});
@ -971,6 +1050,9 @@ TEST_F(MindDataTestPipeline, TestRandomResizeWithBBoxSuccess1) {
config::set_seed(current_seed);
}
/// Feature: RandomResizeWithBBox op
/// Description: Test RandomResizeWithBBox op with (height, width) input
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestRandomResizeWithBBoxSuccess2) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRandomResizeWithBBoxSuccess2 with (height, width) input.";
uint32_t current_seed = config::get_seed();
@ -987,7 +1069,7 @@ TEST_F(MindDataTestPipeline, TestRandomResizeWithBBoxSuccess2) {
EXPECT_NE(ds, nullptr);
// Create objects for the tensor ops
std::shared_ptr<TensorTransform> random_resize(new vision::RandomResizeWithBBox({88, 99}));
auto random_resize = std::make_shared<vision::RandomResizeWithBBox>(std::vector<int32_t>{88, 99});
// Create a Map operation on ds
ds = ds->Map({random_resize}, {"image", "bbox"});
@ -1018,6 +1100,9 @@ TEST_F(MindDataTestPipeline, TestRandomResizeWithBBoxSuccess2) {
config::set_seed(current_seed);
}
/// Feature: RandomResizedCrop op
/// Description: Test RandomResizedCrop op with default values
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestRandomResizedCropSuccess1) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRandomResizedCropSuccess1.";
// Testing RandomResizedCrop with default values
@ -1027,7 +1112,7 @@ TEST_F(MindDataTestPipeline, TestRandomResizedCropSuccess1) {
EXPECT_NE(ds, nullptr);
// Create objects for the tensor ops
std::shared_ptr<TensorTransform> random_resized_crop(new vision::RandomResizedCrop({5}));
auto random_resized_crop = std::make_shared<vision::RandomResizedCrop>(std::vector<int32_t>{5});
// Create a Map operation on ds
ds = ds->Map({random_resized_crop}, {"image"});
@ -1057,6 +1142,9 @@ TEST_F(MindDataTestPipeline, TestRandomResizedCropSuccess1) {
iter->Stop();
}
/// Feature: RandomResizedCrop op
/// Description: Test RandomResizedCrop op with non-default values
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestRandomResizedCropSuccess2) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRandomResizedCropSuccess2.";
// Testing RandomResizedCrop with non-default values
@ -1066,8 +1154,9 @@ TEST_F(MindDataTestPipeline, TestRandomResizedCropSuccess2) {
EXPECT_NE(ds, nullptr);
// Create objects for the tensor ops
std::shared_ptr<TensorTransform> random_resized_crop(new vision::RandomResizedCrop(
{5, 10}, {0.25, 0.75}, {0.5, 1.25}, mindspore::dataset::InterpolationMode::kArea, 20));
auto random_resized_crop = std::make_shared<vision::RandomResizedCrop>(
std::vector<int32_t>{5, 10}, std::vector<float>{0.25, 0.75}, std::vector<float>{0.5, 1.25},
mindspore::dataset::InterpolationMode::kArea, 20);
// Create a Map operation on ds
ds = ds->Map({random_resized_crop}, {"image"});
@ -1097,6 +1186,9 @@ TEST_F(MindDataTestPipeline, TestRandomResizedCropSuccess2) {
iter->Stop();
}
/// Feature: RandomResizedCrop op
/// Description: Test RandomResizedCrop op with negative size
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestRandomResizedCropFail1) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRandomResizedCropFail1 with negative size.";
// This should fail because size has negative value
@ -1106,7 +1198,7 @@ TEST_F(MindDataTestPipeline, TestRandomResizedCropFail1) {
EXPECT_NE(ds, nullptr);
// Create objects for the tensor ops
std::shared_ptr<TensorTransform> random_resized_crop(new vision::RandomResizedCrop({5, -10}));
auto random_resized_crop = std::make_shared<vision::RandomResizedCrop>(std::vector<int32_t>{5, -10});
// Create a Map operation on ds
ds = ds->Map({random_resized_crop});
@ -1117,6 +1209,9 @@ TEST_F(MindDataTestPipeline, TestRandomResizedCropFail1) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: RandomResizedCrop op
/// Description: Test RandomResizedCrop op with invalid scale input
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestRandomResizedCropFail2) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRandomResizedCropFail1 with invalid scale input.";
// This should fail because scale isn't in {min, max} format
@ -1126,7 +1221,8 @@ TEST_F(MindDataTestPipeline, TestRandomResizedCropFail2) {
EXPECT_NE(ds, nullptr);
// Create objects for the tensor ops
std::shared_ptr<TensorTransform> random_resized_crop(new vision::RandomResizedCrop({5, 10}, {4, 3}));
auto random_resized_crop = std::make_shared<vision::RandomResizedCrop>(
std::vector<int32_t>{5, 10}, std::vector<float>{4, 3});
// Create a Map operation on ds
ds = ds->Map({random_resized_crop});
@ -1137,6 +1233,9 @@ TEST_F(MindDataTestPipeline, TestRandomResizedCropFail2) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: RandomResizedCrop op
/// Description: Test RandomResizedCrop op with invalid ratio input
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestRandomResizedCropFail3) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRandomResizedCropFail1 with invalid ratio input.";
// This should fail because ratio isn't in {min, max} format
@ -1146,7 +1245,8 @@ TEST_F(MindDataTestPipeline, TestRandomResizedCropFail3) {
EXPECT_NE(ds, nullptr);
// Create objects for the tensor ops
std::shared_ptr<TensorTransform> random_resized_crop(new vision::RandomResizedCrop({5, 10}, {4, 5}, {7, 6}));
auto random_resized_crop = std::make_shared<vision::RandomResizedCrop>(
std::vector<int32_t>{5, 10}, std::vector<float>{4, 5}, std::vector<float>{7, 6});
// Create a Map operation on ds
ds = ds->Map({random_resized_crop});
@ -1157,6 +1257,9 @@ TEST_F(MindDataTestPipeline, TestRandomResizedCropFail3) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: RandomResizedCrop op
/// Description: Test RandomResizedCrop op with invalid scale size
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestRandomResizedCropFail4) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRandomResizedCropFail1 with invalid scale size.";
// This should fail because scale has a size of more than 2
@ -1166,7 +1269,8 @@ TEST_F(MindDataTestPipeline, TestRandomResizedCropFail4) {
EXPECT_NE(ds, nullptr);
// Create objects for the tensor ops
std::shared_ptr<TensorTransform> random_resized_crop(new vision::RandomResizedCrop({5, 10, 20}, {4, 5}, {7, 6}));
auto random_resized_crop = std::make_shared<vision::RandomResizedCrop>(
std::vector<int32_t>{5, 10, 20}, std::vector<float>{4, 5}, std::vector<float>{7, 6});
// Create a Map operation on ds
ds = ds->Map({random_resized_crop});
@ -1177,6 +1281,9 @@ TEST_F(MindDataTestPipeline, TestRandomResizedCropFail4) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: RandomResizedCropWithBBox op
/// Description: Test RandomResizedCropWithBBox op with default values
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestRandomResizedCropWithBBoxSuccess1) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRandomResizedCropWithBBoxSuccess1.";
// Testing RandomResizedCropWithBBox with default values
@ -1189,7 +1296,7 @@ TEST_F(MindDataTestPipeline, TestRandomResizedCropWithBBoxSuccess1) {
EXPECT_NE(ds, nullptr);
// Create objects for the tensor ops
std::shared_ptr<TensorTransform> random_resized_crop(new vision::RandomResizedCropWithBBox({5}));
auto random_resized_crop = std::make_shared<vision::RandomResizedCropWithBBox>(std::vector<int32_t>{5});
// Create a Map operation on ds
ds = ds->Map({random_resized_crop}, {"image", "bbox"});
@ -1220,6 +1327,9 @@ TEST_F(MindDataTestPipeline, TestRandomResizedCropWithBBoxSuccess1) {
iter->Stop();
}
/// Feature: RandomResizedCropWithBBox op
/// Description: Test RandomResizedCropWithBBox op with non-default values
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestRandomResizedCropWithBBoxSuccess2) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRandomResizedCropWithBBoxSuccess2.";
// Testing RandomResizedCropWithBBox with non-default values
@ -1232,8 +1342,9 @@ TEST_F(MindDataTestPipeline, TestRandomResizedCropWithBBoxSuccess2) {
EXPECT_NE(ds, nullptr);
// Create objects for the tensor ops
std::shared_ptr<TensorTransform> random_resized_crop(new vision::RandomResizedCropWithBBox(
{5, 10}, {0.25, 0.75}, {0.5, 1.25}, mindspore::dataset::InterpolationMode::kArea, 20));
auto random_resized_crop = std::make_shared<vision::RandomResizedCropWithBBox>(
std::vector<int32_t>{5, 10}, std::vector<float>{0.25, 0.75}, std::vector<float>{0.5, 1.25},
mindspore::dataset::InterpolationMode::kArea, 20);
// Create a Map operation on ds
ds = ds->Map({random_resized_crop}, {"image", "bbox"});
@ -1264,6 +1375,9 @@ TEST_F(MindDataTestPipeline, TestRandomResizedCropWithBBoxSuccess2) {
iter->Stop();
}
/// Feature: RandomResizedCropWithBBox op
/// Description: Test RandomResizedCropWithBBox op with negative size value
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestRandomResizedCropWithBBoxFail1) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRandomResizedCropWithBBoxFail1 with negative size value.";
// This should fail because size has negative value
@ -1273,7 +1387,7 @@ TEST_F(MindDataTestPipeline, TestRandomResizedCropWithBBoxFail1) {
EXPECT_NE(ds, nullptr);
// Create objects for the tensor ops
std::shared_ptr<TensorTransform> random_resized_crop(new vision::RandomResizedCropWithBBox({5, -10}));
auto random_resized_crop = std::make_shared<vision::RandomResizedCropWithBBox>(std::vector<int32_t>{5, -10});
auto ds1 = ds->Map({random_resized_crop});
EXPECT_NE(ds1, nullptr);
// Create an iterator over the result of the above dataset
@ -1282,6 +1396,9 @@ TEST_F(MindDataTestPipeline, TestRandomResizedCropWithBBoxFail1) {
EXPECT_EQ(iter1, nullptr);
}
/// Feature: RandomResizedCropWithBBox op
/// Description: Test RandomResizedCropWithBBox op with invalid scale input
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestRandomResizedCropWithBBoxFail2) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRandomResizedCropWithBBoxFail2 with invalid scale input.";
// This should fail because scale isn't in {min, max} format
@ -1291,7 +1408,8 @@ TEST_F(MindDataTestPipeline, TestRandomResizedCropWithBBoxFail2) {
EXPECT_NE(ds, nullptr);
// Create objects for the tensor ops
std::shared_ptr<TensorTransform> random_resized_crop(new vision::RandomResizedCropWithBBox({5, 10}, {4, 3}));
auto random_resized_crop = std::make_shared<vision::RandomResizedCropWithBBox>(
std::vector<int32_t>{5, 10}, std::vector<float>{4, 3});
auto ds1 = ds->Map({random_resized_crop});
EXPECT_NE(ds1, nullptr);
// Create an iterator over the result of the above dataset
@ -1300,6 +1418,9 @@ TEST_F(MindDataTestPipeline, TestRandomResizedCropWithBBoxFail2) {
EXPECT_EQ(iter1, nullptr);
}
/// Feature: RandomResizedCropWithBBox op
/// Description: Test RandomResizedCropWithBBox op with invalid ratio input
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestRandomResizedCropWithBBoxFail3) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRandomResizedCropWithBBoxFail3 with invalid ratio input.";
// This should fail because ratio isn't in {min, max} format
@ -1309,7 +1430,8 @@ TEST_F(MindDataTestPipeline, TestRandomResizedCropWithBBoxFail3) {
EXPECT_NE(ds, nullptr);
// Create objects for the tensor ops
std::shared_ptr<TensorTransform> random_resized_crop(new vision::RandomResizedCropWithBBox({5, 10}, {4, 5}, {7, 6}));
auto random_resized_crop = std::make_shared<vision::RandomResizedCropWithBBox>(
std::vector<int32_t>{5, 10}, std::vector<float>{4, 5}, std::vector<float>{7, 6});
auto ds1 = ds->Map({random_resized_crop});
EXPECT_NE(ds1, nullptr);
// Create an iterator over the result of the above dataset
@ -1318,6 +1440,9 @@ TEST_F(MindDataTestPipeline, TestRandomResizedCropWithBBoxFail3) {
EXPECT_EQ(iter1, nullptr);
}
/// Feature: RandomResizedCropWithBBox op
/// Description: Test RandomResizedCropWithBBox op with invalid scale size
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestRandomResizedCropWithBBoxFail4) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRandomResizedCropWithBBoxFail4 with invalid scale size.";
// This should fail because scale has a size of more than 2
@ -1327,8 +1452,8 @@ TEST_F(MindDataTestPipeline, TestRandomResizedCropWithBBoxFail4) {
EXPECT_NE(ds, nullptr);
// Create objects for the tensor ops
std::shared_ptr<TensorTransform> random_resized_crop(
new vision::RandomResizedCropWithBBox({5, 10, 20}, {4, 5}, {7, 6}));
auto random_resized_crop = std::make_shared<vision::RandomResizedCropWithBBox>(
std::vector<int32_t>{5, 10, 20}, std::vector<float>{4, 5}, std::vector<float>{7, 6});
auto ds1 = ds->Map({random_resized_crop});
EXPECT_NE(ds1, nullptr);
// Create an iterator over the result of the above dataset
@ -1337,6 +1462,9 @@ TEST_F(MindDataTestPipeline, TestRandomResizedCropWithBBoxFail4) {
EXPECT_EQ(iter1, nullptr);
}
/// Feature: RandomRotation op
/// Description: Test RandomRotation op with various size of degree and size of fill_value inputs
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestRandomRotation) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRandomRotation.";
@ -1352,15 +1480,17 @@ TEST_F(MindDataTestPipeline, TestRandomRotation) {
// Create objects for the tensor ops
// Testing the size of degrees is 1
std::shared_ptr<TensorTransform> random_rotation_op(new vision::RandomRotation({180}));
auto random_rotation_op = std::make_shared<vision::RandomRotation>(std::vector<float>{180});
// Testing the size of degrees is 2
std::shared_ptr<TensorTransform> random_rotation_op1(new vision::RandomRotation({-180, 180}));
auto random_rotation_op1 = std::make_shared<vision::RandomRotation>(std::vector<float>{-180, 180});
// Testing the size of fill_value is 1
std::shared_ptr<TensorTransform> random_rotation_op2(
new vision::RandomRotation({180}, InterpolationMode::kNearestNeighbour, false, {-1, -1}, {2}));
auto random_rotation_op2 = std::make_shared<vision::RandomRotation>(
std::vector<float>{180}, InterpolationMode::kNearestNeighbour, false, std::vector<float>{-1, -1},
std::vector<uint8_t>{2});
// Testing the size of fill_value is 3
std::shared_ptr<TensorTransform> random_rotation_op3(
new vision::RandomRotation({180}, InterpolationMode::kNearestNeighbour, false, {-1, -1}, {2, 2, 2}));
auto random_rotation_op3 = std::make_shared<vision::RandomRotation>(
std::vector<float>{180}, InterpolationMode::kNearestNeighbour, false, std::vector<float>{-1, -1},
std::vector<uint8_t>{2, 2, 2});
// Create a Map operation on ds
ds = ds->Map({random_rotation_op, random_rotation_op1, random_rotation_op2, random_rotation_op3});
@ -1394,6 +1524,9 @@ TEST_F(MindDataTestPipeline, TestRandomRotation) {
iter->Stop();
}
/// Feature: RandomRotation op
/// Description: Test RandomRotation op with invalid parameters
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestRandomRotationFail) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRandomRotationFail with invalid parameters.";
// Create an ImageFolder Dataset
@ -1403,7 +1536,7 @@ TEST_F(MindDataTestPipeline, TestRandomRotationFail) {
// Case 1: Testing the size of degrees vector is 0
// Create objects for the tensor ops
std::shared_ptr<TensorTransform> random_rotation_op1(new vision::RandomRotation({}));
auto random_rotation_op1 = std::make_shared<vision::RandomRotation>(std::vector<float>{});
auto ds1 = ds->Map({random_rotation_op1});
EXPECT_NE(ds1, nullptr);
// Create an iterator over the result of the above dataset
@ -1413,7 +1546,7 @@ TEST_F(MindDataTestPipeline, TestRandomRotationFail) {
// Case 2: Testing the size of degrees vector is 3
// Create objects for the tensor ops
std::shared_ptr<TensorTransform> random_rotation_op2(new vision::RandomRotation({-50.0, 50.0, 100.0}));
auto random_rotation_op2 = std::make_shared<vision::RandomRotation>(std::vector<float>{-50.0, 50.0, 100.0});
auto ds2 = ds->Map({random_rotation_op2});
EXPECT_NE(ds2, nullptr);
// Create an iterator over the result of the above dataset
@ -1423,7 +1556,7 @@ TEST_F(MindDataTestPipeline, TestRandomRotationFail) {
// Case 3: Test the case where the first column value of degrees is greater than the second column value
// Create objects for the tensor ops
std::shared_ptr<TensorTransform> random_rotation_op3(new vision::RandomRotation({50.0, -50.0}));
auto random_rotation_op3 = std::make_shared<vision::RandomRotation>(std::vector<float>{50.0, -50.0});
auto ds3 = ds->Map({random_rotation_op3});
EXPECT_NE(ds3, nullptr);
// Create an iterator over the result of the above dataset
@ -1433,8 +1566,9 @@ TEST_F(MindDataTestPipeline, TestRandomRotationFail) {
// Case 4: Testing the size of center vector is 1
// Create objects for the tensor ops
std::shared_ptr<TensorTransform> random_rotation_op4(
new vision::RandomRotation({-50.0, 50.0}, mindspore::dataset::InterpolationMode::kNearestNeighbour, false, {-1.0}));
auto random_rotation_op4 = std::make_shared<vision::RandomRotation>(
std::vector<float>{-50.0, 50.0}, mindspore::dataset::InterpolationMode::kNearestNeighbour, false,
std::vector<float>{-1.0});
auto ds4 = ds->Map({random_rotation_op4});
EXPECT_NE(ds4, nullptr);
// Create an iterator over the result of the above dataset
@ -1444,8 +1578,9 @@ TEST_F(MindDataTestPipeline, TestRandomRotationFail) {
// Case 5: Testing the size of center vector is 3
// Create objects for the tensor ops
std::shared_ptr<TensorTransform> random_rotation_op5(new vision::RandomRotation(
{-50.0, 50.0}, mindspore::dataset::InterpolationMode::kNearestNeighbour, false, {-1.0, -1.0, -1.0}));
auto random_rotation_op5 = std::make_shared<vision::RandomRotation>(
std::vector<float>{-50.0, 50.0}, mindspore::dataset::InterpolationMode::kNearestNeighbour, false,
std::vector<float>{-1.0, -1.0, -1.0});
auto ds5 = ds->Map({random_rotation_op5});
EXPECT_NE(ds5, nullptr);
// Create an iterator over the result of the above dataset
@ -1455,8 +1590,9 @@ TEST_F(MindDataTestPipeline, TestRandomRotationFail) {
// Case 6: Testing the size of fill_value vector is 2
// Create objects for the tensor ops
std::shared_ptr<TensorTransform> random_rotation_op6(new vision::RandomRotation(
{-50.0, 50.0}, mindspore::dataset::InterpolationMode::kNearestNeighbour, false, {-1.0, -1.0}, {2, 2}));
auto random_rotation_op6 = std::make_shared<vision::RandomRotation>(
std::vector<float>{-50.0, 50.0}, mindspore::dataset::InterpolationMode::kNearestNeighbour, false,
std::vector<float>{-1.0, -1.0}, std::vector<uint8_t>{2, 2});
auto ds6 = ds->Map({random_rotation_op6});
EXPECT_NE(ds6, nullptr);
// Create an iterator over the result of the above dataset
@ -1466,8 +1602,9 @@ TEST_F(MindDataTestPipeline, TestRandomRotationFail) {
// Case 7: Testing the size of fill_value vector is 4
// Create objects for the tensor ops
std::shared_ptr<TensorTransform> random_rotation_op7(new vision::RandomRotation(
{-50.0, 50.0}, mindspore::dataset::InterpolationMode::kNearestNeighbour, false, {-1.0, -1.0}, {2, 2, 2, 2}));
auto random_rotation_op7 = std::make_shared<vision::RandomRotation>(
std::vector<float>{-50.0, 50.0}, mindspore::dataset::InterpolationMode::kNearestNeighbour, false,
std::vector<float>{-1.0, -1.0}, std::vector<uint8_t>{2, 2, 2, 2});
auto ds7 = ds->Map({random_rotation_op7});
EXPECT_NE(ds7, nullptr);
// Create an iterator over the result of the above dataset
@ -1476,6 +1613,9 @@ TEST_F(MindDataTestPipeline, TestRandomRotationFail) {
EXPECT_EQ(iter7, nullptr);
}
/// Feature: RandomSharpness op
/// Description: Test RandomSharpness op basic usage
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestRandomSharpness) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRandomSharpness.";
@ -1491,10 +1631,10 @@ TEST_F(MindDataTestPipeline, TestRandomSharpness) {
// Create objects for the tensor ops
// Valid case: Input start degree and end degree
std::shared_ptr<TensorTransform> random_sharpness_op_1(new vision::RandomSharpness({0.4, 2.3}));
auto random_sharpness_op_1 = std::make_shared<vision::RandomSharpness>(std::vector<float>{0.4, 2.3});
// Valid case: Use default input values
std::shared_ptr<TensorTransform> random_sharpness_op_2(new vision::RandomSharpness());
auto random_sharpness_op_2 = std::make_shared<vision::RandomSharpness>();
// Create a Map operation on ds
ds = ds->Map({random_sharpness_op_1, random_sharpness_op_2});
@ -1528,6 +1668,9 @@ TEST_F(MindDataTestPipeline, TestRandomSharpness) {
iter->Stop();
}
/// Feature: RandomSolarize op
/// Description: Test RandomSolarize op with non-default parameters
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestRandomSolarizeSucess1) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRandomSolarizeSucess1.";
@ -1568,6 +1711,9 @@ TEST_F(MindDataTestPipeline, TestRandomSolarizeSucess1) {
iter->Stop();
}
/// Feature: RandomSolarize op
/// Description: Test RandomSolarize op with default parameters
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestRandomSolarizeSucess2) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRandomSolarizeSuccess2 with default parameters.";
@ -1606,6 +1752,9 @@ TEST_F(MindDataTestPipeline, TestRandomSolarizeSucess2) {
iter->Stop();
}
/// Feature: RandomVerticalFlipWithBBox op
/// Description: Test RandomVerticalFlipWithBBox op basic usage
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestRandomVerticalFlipWithBBoxSuccess) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRandomVerticalFlipWithBBoxSuccess.";
// Create an VOC Dataset
@ -1643,6 +1792,9 @@ TEST_F(MindDataTestPipeline, TestRandomVerticalFlipWithBBoxSuccess) {
iter->Stop();
}
/// Feature: RandomHorizontalFlip and RandomVerticalFlip ops
/// Description: Test RandomVerticalFlip op and RandomHorizontalFlip op with multiple fields
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestRandomHorizontalAndVerticalFlipWithMultiField) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRandomHorizontalAndVerticalFlipWithMultiField for horizontal and "
"vertical flips.";
@ -1689,6 +1841,9 @@ TEST_F(MindDataTestPipeline, TestRandomHorizontalAndVerticalFlipWithMultiField)
iter->Stop();
}
/// Feature: RandomCropDecodeResize op
/// Description: Test RandomCropDecodeResize op with multiple fields
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestRandomCropDecodeResizeWithMultiField) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRandomCropDecodeResizeWithMultiField.";
@ -1699,7 +1854,7 @@ TEST_F(MindDataTestPipeline, TestRandomCropDecodeResizeWithMultiField) {
// Create objects for the tensor ops
transforms::Duplicate duplicate = transforms::Duplicate();
std::shared_ptr<TensorTransform> random_crop_decode_resize(new vision::RandomCropDecodeResize({500, 500}));
auto random_crop_decode_resize = std::make_shared<vision::RandomCropDecodeResize>(std::vector<int32_t>{500, 500});
// Create a Map operation on ds
ds = ds->Map({duplicate}, {"image"}, {"image", "image_copy"});
@ -1734,6 +1889,9 @@ TEST_F(MindDataTestPipeline, TestRandomCropDecodeResizeWithMultiField) {
iter->Stop();
}
/// Feature: RandomCropResize op
/// Description: Test RandomCropResize op with multiple fields
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestRandomCropResizeWithMultiField) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestRandomCropResizeWithMultiField.";
@ -1744,7 +1902,7 @@ TEST_F(MindDataTestPipeline, TestRandomCropResizeWithMultiField) {
// Create objects for the tensor ops
transforms::Duplicate duplicate = transforms::Duplicate();
std::shared_ptr<TensorTransform> random_crop_decode_resize(new vision::RandomResizedCrop({500, 500}));
auto random_crop_decode_resize = std::make_shared<vision::RandomResizedCrop>(std::vector<int32_t>{500, 500});
// Create a Map operation on ds
ds = ds->Map({duplicate}, {"image"}, {"image", "image_copy"});

View File

@ -1,5 +1,5 @@
/**
* Copyright 2021 Huawei Technologies Co., Ltd
* Copyright 2021-2022 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -26,6 +26,9 @@ class MindDataTestSlicePatches : public UT::DatasetOpTesting {
protected:
};
/// Feature: SlicePatches op
/// Description: Test SlicePatches op with invalid inputs (num_height and num_width)
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestSlicePatches, TestSlicePacthesParamCheck) {
MS_LOG(INFO) << "Doing TestSlicePatchesParamCheck with invalid parameters.";
// Create an ImageFolder Dataset
@ -35,7 +38,7 @@ TEST_F(MindDataTestSlicePatches, TestSlicePacthesParamCheck) {
// Case 1: num_height is not positive
// Create objects for the tensor ops
std::shared_ptr<TensorTransform> slice_patches_1(new vision::SlicePatches(-1));
auto slice_patches_1 = std::make_shared<vision::SlicePatches>(-1);
auto ds1 = ds->Map({slice_patches_1});
EXPECT_NE(ds1, nullptr);
// Create an iterator over the result of the above dataset
@ -45,7 +48,7 @@ TEST_F(MindDataTestSlicePatches, TestSlicePacthesParamCheck) {
// Case 2: num_width is not positive
// Create objects for the tensor ops
std::shared_ptr<TensorTransform> slice_patches_2(new vision::SlicePatches(1, 0));
auto slice_patches_2 = std::make_shared<vision::SlicePatches>(1, 0);
auto ds2 = ds->Map({slice_patches_2});
EXPECT_NE(ds2, nullptr);
// Create an iterator over the result of the above dataset
@ -54,7 +57,9 @@ TEST_F(MindDataTestSlicePatches, TestSlicePacthesParamCheck) {
EXPECT_EQ(iter2, nullptr);
}
/// Feature: SlicePatches op
/// Description: Test SlicePatches op in pipeline mode
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestSlicePatches, TestSlicePatchesPipeline) {
MS_LOG(INFO) << "Doing TestGaussianBlurPipeline.";
@ -64,7 +69,7 @@ TEST_F(MindDataTestSlicePatches, TestSlicePatchesPipeline) {
EXPECT_NE(ds, nullptr);
// Create objects for the tensor ops
std::shared_ptr<TensorTransform> slice_patches(new vision::SlicePatches(2, 2));
auto slice_patches = std::make_shared<vision::SlicePatches>(2, 2);
// Create a Map operation on ds
ds = ds->Map({slice_patches}, {"image"}, {"img0", "img1", "img2", "img3"}, {"img0", "img1", "img2", "img3"});
@ -97,6 +102,9 @@ TEST_F(MindDataTestSlicePatches, TestSlicePatchesPipeline) {
iter->Stop();
}
/// Feature: SlicePatches op
/// Description: Test SlicePatches op in eager mode
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestSlicePatches, TestSlicePatchesEager) {
MS_LOG(INFO) << "Doing TestGaussianBlurEager.";

View File

@ -1,5 +1,5 @@
/**
* Copyright 2020-2021 Huawei Technologies Co., Ltd
* Copyright 2020-2022 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -27,6 +27,9 @@ class MindDataTestPipeline : public UT::DatasetOpTesting {
// Tests for vision UniformAugment
// Tests for vision C++ API UniformAugment TensorTransform Operations
/// Feature: UniformAugment op
/// Description: Test UniformAugment op with shared pointer
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestUniformAugWithOps1Shr) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestUniformAugWithOps1Shr.";
@ -42,10 +45,11 @@ TEST_F(MindDataTestPipeline, TestUniformAugWithOps1Shr) {
// Create objects for the tensor ops
// Use shared pointers
std::shared_ptr<TensorTransform> resize_op(new vision::Resize({30, 30}));
std::shared_ptr<TensorTransform> random_crop_op(new vision::RandomCrop({28, 28}));
std::shared_ptr<TensorTransform> center_crop_op(new vision::CenterCrop({16, 16}));
std::shared_ptr<TensorTransform> uniform_aug_op(new vision::UniformAugment({random_crop_op, center_crop_op}, 2));
auto resize_op = std::make_shared<vision::Resize>(std::vector<int32_t>{30, 30});
auto random_crop_op = std::make_shared<vision::RandomCrop>(std::vector<int32_t>{28, 28});
auto center_crop_op = std::make_shared<vision::CenterCrop>(std::vector<int32_t>{16, 16});
auto uniform_aug_op = std::make_shared<vision::UniformAugment>(
std::vector<std::shared_ptr<TensorTransform>>{random_crop_op, center_crop_op}, 2);
// Create a Map operation on ds
ds = ds->Map({resize_op, uniform_aug_op});
@ -74,6 +78,9 @@ TEST_F(MindDataTestPipeline, TestUniformAugWithOps1Shr) {
iter->Stop();
}
/// Feature: UniformAugment op
/// Description: Test UniformAugment op with auto assignment
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestUniformAugWithOps2Auto) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestUniformAugWithOps2Auto.";
@ -128,6 +135,9 @@ TEST_F(MindDataTestPipeline, TestUniformAugWithOps2Auto) {
delete uniform_aug_op;
}
/// Feature: UniformAugment op
/// Description: Test UniformAugment op with object definition
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestPipeline, TestUniformAugWithOps3Obj) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestUniformAugWithOps3Obj.";
@ -175,6 +185,9 @@ TEST_F(MindDataTestPipeline, TestUniformAugWithOps3Obj) {
iter->Stop();
}
/// Feature: UniformAugment op
/// Description: Test UniformAugment op with invalid num_ops=0
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestUniformAugmentFail1num_ops) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestUniformAugmentFail1num_ops with invalid num_ops parameter.";
@ -184,11 +197,12 @@ TEST_F(MindDataTestPipeline, TestUniformAugmentFail1num_ops) {
EXPECT_NE(ds, nullptr);
// Create objects for the tensor ops
std::shared_ptr<TensorTransform> random_crop_op(new vision::RandomCrop({28, 28}));
std::shared_ptr<TensorTransform> center_crop_op(new vision::CenterCrop({16, 16}));
auto random_crop_op = std::make_shared<vision::RandomCrop>(std::vector<int32_t>{28, 28});
auto center_crop_op = std::make_shared<vision::CenterCrop>(std::vector<int32_t>{16, 16});
// UniformAug: num_ops must be greater than 0
std::shared_ptr<TensorTransform> uniform_aug_op(new vision::UniformAugment({random_crop_op, center_crop_op}, 0));
auto uniform_aug_op = std::make_shared<vision::UniformAugment>(
std::vector<std::shared_ptr<TensorTransform>>{random_crop_op, center_crop_op}, 0);
// Create a Map operation on ds
ds = ds->Map({uniform_aug_op}, {"image", "bbox"}, {"image", "bbox"}, {"image", "bbox"});
@ -200,6 +214,9 @@ TEST_F(MindDataTestPipeline, TestUniformAugmentFail1num_ops) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: UniformAugment op
/// Description: Test UniformAugment op with invalid num_ops > transform size
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestUniformAugmentFail2num_ops) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestUniformAugmentFail2num_ops with invalid num_ops parameter.";
@ -209,11 +226,12 @@ TEST_F(MindDataTestPipeline, TestUniformAugmentFail2num_ops) {
EXPECT_NE(ds, nullptr);
// Create objects for the tensor ops
std::shared_ptr<TensorTransform> random_crop_op(new vision::RandomCrop({28, 28}));
std::shared_ptr<TensorTransform> center_crop_op(new vision::CenterCrop({16, 16}));
auto random_crop_op = std::make_shared<vision::RandomCrop>(std::vector<int32_t>{28, 28});
auto center_crop_op = std::make_shared<vision::CenterCrop>(std::vector<int32_t>{16, 16});
// UniformAug: num_ops is greater than transforms size
std::shared_ptr<TensorTransform> uniform_aug_op(new vision::UniformAugment({random_crop_op, center_crop_op}, 3));
auto uniform_aug_op = std::make_shared<vision::UniformAugment>(
std::vector<std::shared_ptr<TensorTransform>>{random_crop_op, center_crop_op}, 3);
// Create a Map operation on ds
ds = ds->Map({uniform_aug_op}, {"image", "bbox"}, {"image", "bbox"}, {"image", "bbox"});
@ -225,6 +243,9 @@ TEST_F(MindDataTestPipeline, TestUniformAugmentFail2num_ops) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: UniformAugment op
/// Description: Test UniformAugment op with invalid transform op
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestUniformAugmentFail3transforms) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestUniformAugmentFail3transforms with invalid transform.";
@ -235,10 +256,11 @@ TEST_F(MindDataTestPipeline, TestUniformAugmentFail3transforms) {
// Create objects for the tensor ops
// RandomRotation has invalid input, negative size
std::shared_ptr<TensorTransform> random_crop_op(new vision::RandomCrop({-28}));
auto random_crop_op = std::make_shared<vision::RandomCrop>(std::vector<int32_t>{-28});
// Create UniformAug op with invalid transform op
std::shared_ptr<TensorTransform> uniform_aug_op(new vision::UniformAugment({random_crop_op}, 1));
auto uniform_aug_op = std::make_shared<vision::UniformAugment>(
std::vector<std::shared_ptr<TensorTransform>>{random_crop_op}, 1);
// Create a Map operation on ds
ds = ds->Map({uniform_aug_op}, {"image", "bbox"}, {"image", "bbox"}, {"image", "bbox"});
@ -250,6 +272,9 @@ TEST_F(MindDataTestPipeline, TestUniformAugmentFail3transforms) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: UniformAugment op
/// Description: Test UniformAugment op with null transform op
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestUniformAugmentFail4transforms) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestUniformAugmentFail4transforms with invalid transform.";
@ -259,10 +284,11 @@ TEST_F(MindDataTestPipeline, TestUniformAugmentFail4transforms) {
EXPECT_NE(ds, nullptr);
// Create objects for the tensor ops
std::shared_ptr<TensorTransform> random_crop_op(new vision::RandomCrop({28}));
auto random_crop_op = std::make_shared<vision::RandomCrop>(std::vector<int32_t>{28});
// Create UniformAug op with invalid transform op, nullptr
std::shared_ptr<TensorTransform> uniform_aug_op(new vision::UniformAugment({random_crop_op, nullptr}, 2));
auto uniform_aug_op = std::make_shared<vision::UniformAugment>(
std::vector<std::shared_ptr<TensorTransform>>{random_crop_op, nullptr}, 2);
// Create a Map operation on ds
ds = ds->Map({uniform_aug_op}, {"image", "bbox"}, {"image", "bbox"}, {"image", "bbox"});
@ -274,6 +300,9 @@ TEST_F(MindDataTestPipeline, TestUniformAugmentFail4transforms) {
EXPECT_EQ(iter, nullptr);
}
/// Feature: UniformAugment op
/// Description: Test UniformAugment op with invalid transform op empty list
/// Expectation: Error message is logged, and CreateIterator() for invalid pipeline returns nullptr
TEST_F(MindDataTestPipeline, TestUniformAugmentFail5transforms) {
MS_LOG(INFO) << "Doing MindDataTestPipeline-TestUniformAugmentFail5transforms with invalid transform.";
@ -284,7 +313,7 @@ TEST_F(MindDataTestPipeline, TestUniformAugmentFail5transforms) {
// Create UniformAug op with invalid transform op empty list
std::vector<std::shared_ptr<TensorTransform>> list = {};
std::shared_ptr<TensorTransform> uniform_aug_op(new vision::UniformAugment(list, 1));
auto uniform_aug_op = std::make_shared<vision::UniformAugment>(list, 1);
// Create a Map operation on ds
ds = ds->Map({uniform_aug_op}, {"image", "bbox"}, {"image", "bbox"}, {"image", "bbox"});

View File

@ -1,5 +1,5 @@
/**
* Copyright 2021 Huawei Technologies Co., Ltd
* Copyright 2021-2022 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -25,6 +25,9 @@ class MindDataTestVerticalFlip : public UT::DatasetOpTesting {
protected:
};
/// Feature: VerticalFlip op
/// Description: Test VerticalFlip op in pipeline mode
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestVerticalFlip, TestVerticalFlipPipeline) {
MS_LOG(INFO) << "Doing MindDataTestVerticalFlip-TestVerticalFlipPipeline.";
@ -34,7 +37,7 @@ TEST_F(MindDataTestVerticalFlip, TestVerticalFlipPipeline) {
EXPECT_NE(ds, nullptr);
// Create objects for the tensor ops
std::shared_ptr<TensorTransform> vertical_flip(new vision::VerticalFlip());
auto vertical_flip = std::make_shared<vision::VerticalFlip>();
// Create a Map operation on ds
ds = ds->Map({vertical_flip});
@ -68,6 +71,9 @@ TEST_F(MindDataTestVerticalFlip, TestVerticalFlipPipeline) {
iter->Stop();
}
/// Feature: VerticalFlip op
/// Description: Test VerticalFlip op in eager mode
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestVerticalFlip, TestVerticalFlipEager) {
MS_LOG(INFO) << "Doing MindDataTestVerticalFlip-TestVerticalFlipEager.";

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
/**
* Copyright 2020-2021 Huawei Technologies Co., Ltd
* Copyright 2020-2022 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -126,6 +126,9 @@ void AccuracyComparison(const std::vector<std::vector<double>> &expect, LiteMat
}
}
/// Feature: InitFromPixel
/// Description: Test InitFromPixel with LPixelType::RGB
/// Expectation: Output is equal to the expected output
TEST_F(MindDataImageProcess, testRGB) {
std::string filename = "data/dataset/apple.jpg";
cv::Mat image = cv::imread(filename, cv::ImreadModes::IMREAD_COLOR);
@ -141,6 +144,9 @@ TEST_F(MindDataImageProcess, testRGB) {
cv::Mat dst_image(lite_mat_rgb.height_, lite_mat_rgb.width_, CV_8UC3, lite_mat_rgb.data_ptr_);
}
/// Feature: LiteMat
/// Description: Test load data to lite_mat_rgb by memory pointer
/// Expectation: Output is equal to the expected output
TEST_F(MindDataImageProcess, testLoadByMemPtr) {
std::string filename = "data/dataset/apple.jpg";
cv::Mat image = cv::imread(filename, cv::ImreadModes::IMREAD_COLOR);
@ -188,6 +194,9 @@ TEST_F(MindDataImageProcess, testLoadByMemPtr) {
free(p_rgb_pad);
}
/// Feature: Image Process
/// Description: Test processing an image to image with 3 channels
/// Expectation: Output is equal to the expected output
TEST_F(MindDataImageProcess, test3C) {
std::string filename = "data/dataset/apple.jpg";
cv::Mat image = cv::imread(filename, cv::ImreadModes::IMREAD_COLOR);
@ -209,6 +218,9 @@ TEST_F(MindDataImageProcess, test3C) {
CompareMat(cv_image, lite_norm_mat_cut);
}
/// Feature: ResizeCubic
/// Description: Test ResizeCubic with 3 channels image
/// Expectation: Output is equal to the expected output
TEST_F(MindDataImageProcess, testCubic3C) {
std::string filename = "data/dataset/apple.jpg";
cv::Mat image = cv::imread(filename, cv::ImreadModes::IMREAD_COLOR);
@ -250,6 +262,9 @@ bool ReadYUV(const char *filename, int w, int h, uint8_t **data) {
return true;
}
/// Feature: InitFromPixel
/// Description: Test InitFromPixel with LPixelType::RGBA2GRAY
/// Expectation: Output is equal to the expected output
TEST_F(MindDataImageProcess, TestRGBA2GRAY) {
std::string filename = "data/dataset/apple.jpg";
cv::Mat src_image = cv::imread(filename, cv::ImreadModes::IMREAD_COLOR);
@ -296,6 +311,9 @@ TEST_F(MindDataImageProcess, TestNormalize) {
}
}
/// Feature: InitFromPixel
/// Description: Test InitFromPixel with LPixelType::NV212BGR
/// Expectation: Output is equal to the expected output
TEST_F(MindDataImageProcess, testNV21ToBGR) {
// ffmpeg -i ./data/dataset/apple.jpg -s 1024*800 -pix_fmt nv21 ./data/dataset/yuv/test_nv21.yuv
const char *filename = "data/dataset/yuv/test_nv21.yuv";
@ -318,6 +336,9 @@ TEST_F(MindDataImageProcess, testNV21ToBGR) {
free(yuv_data);
}
/// Feature: InitFromPixel
/// Description: Test InitFromPixel with LPixelType::NV122BGR
/// Expectation: Output is equal to the expected output
TEST_F(MindDataImageProcess, testNV12ToBGR) {
// ffmpeg -i ./data/dataset/apple.jpg -s 1024*800 -pix_fmt nv12 ./data/dataset/yuv/test_nv12.yuv
const char *filename = "data/dataset/yuv/test_nv12.yuv";
@ -339,6 +360,9 @@ TEST_F(MindDataImageProcess, testNV12ToBGR) {
free(yuv_data);
}
/// Feature: ExtractChannel
/// Description: Test ExtractChannel basic usage
/// Expectation: Output is equal to the expected output
TEST_F(MindDataImageProcess, testExtractChannel) {
std::string filename = "data/dataset/apple.jpg";
cv::Mat src_image = cv::imread(filename, cv::ImreadModes::IMREAD_COLOR);
@ -365,6 +389,9 @@ TEST_F(MindDataImageProcess, testExtractChannel) {
// cv::imwrite("./test_lite_r.jpg", dst_imageR);
}
/// Feature: Split
/// Description: Test Split basic usage
/// Expectation: Output is equal to the expected output
TEST_F(MindDataImageProcess, testSplit) {
std::string filename = "data/dataset/apple.jpg";
cv::Mat src_image = cv::imread(filename, cv::ImreadModes::IMREAD_COLOR);
@ -387,6 +414,9 @@ TEST_F(MindDataImageProcess, testSplit) {
cv::Mat dst_imageR(lite_r.height_, lite_r.width_, CV_8UC1, lite_r.data_ptr_);
}
/// Feature: Merge
/// Description: Test Merge basic usage
/// Expectation: Output is equal to the expected output
TEST_F(MindDataImageProcess, testMerge) {
std::string filename = "data/dataset/apple.jpg";
cv::Mat src_image = cv::imread(filename, cv::ImreadModes::IMREAD_COLOR);
@ -463,6 +493,9 @@ cv::Mat cv1CImageProcess(cv::Mat &image) {
return imgR2;
}
/// Feature: ImageProcess
/// Description: Test image processing on to 1 channel image
/// Expectation: Output is equal to the expected output
TEST_F(MindDataImageProcess, test1C) {
std::string filename = "data/dataset/apple.jpg";
cv::Mat image = cv::imread(filename, cv::ImreadModes::IMREAD_COLOR);
@ -482,6 +515,9 @@ TEST_F(MindDataImageProcess, test1C) {
CompareMat(cv_image, lite_norm_mat_cut);
}
/// Feature: Pad
/// Description: Test Pad with PaddBorderType::PADD_BORDER_CONSTANT basic usage
/// Expectation: Output is equal to the expected output
TEST_F(MindDataImageProcess, TestPadd) {
std::string filename = "data/dataset/apple.jpg";
cv::Mat image = cv::imread(filename, cv::ImreadModes::IMREAD_COLOR);
@ -512,6 +548,9 @@ TEST_F(MindDataImageProcess, TestPadd) {
EXPECT_EQ(distance, 0.0f);
}
/// Feature: Pad
/// Description: Test Pad with PaddBorderType::PADD_BORDER_CONSTANT with left=right=top=bottom=0
/// Expectation: Output is equal to the expected output
TEST_F(MindDataImageProcess, TestPadZero) {
std::string filename = "data/dataset/apple.jpg";
cv::Mat image = cv::imread(filename, cv::ImreadModes::IMREAD_COLOR);
@ -542,6 +581,9 @@ TEST_F(MindDataImageProcess, TestPadZero) {
EXPECT_EQ(distance, 0.0f);
}
/// Feature: Pad
/// Description: Test Pad with PaddBorderType::PADD_BORDER_REPLICATE
/// Expectation: Output is equal to the expected output
TEST_F(MindDataImageProcess, TestPadReplicate) {
std::string filename = "data/dataset/apple.jpg";
cv::Mat image = cv::imread(filename, cv::ImreadModes::IMREAD_COLOR);
@ -573,6 +615,9 @@ TEST_F(MindDataImageProcess, TestPadReplicate) {
EXPECT_EQ(distance, 0.0f);
}
/// Feature: Pad
/// Description: Test Pad with PaddBorderType::PADD_BORDER_REFLECT_101
/// Expectation: Output is equal to the expected output
TEST_F(MindDataImageProcess, TestPadReflect101) {
std::string filename = "data/dataset/apple.jpg";
cv::Mat image = cv::imread(filename, cv::ImreadModes::IMREAD_COLOR);
@ -604,6 +649,9 @@ TEST_F(MindDataImageProcess, TestPadReflect101) {
EXPECT_EQ(distance, 0.0f);
}
/// Feature: GetDefaultBoxes
/// Description: Test GetDefaultBoxes basic usage
/// Expectation: Output is equal to the expected output
TEST_F(MindDataImageProcess, TestGetDefaultBoxes) {
std::string benchmark = "data/dataset/testLite/default_boxes.bin";
BoxesConfig config;
@ -637,6 +685,9 @@ TEST_F(MindDataImageProcess, TestGetDefaultBoxes) {
EXPECT_LT(distance, 1e-5);
}
/// Feature: ApplyNms
/// Description: Test ApplyNms basic usage
/// Expectation: Output is equal to the expected output
TEST_F(MindDataImageProcess, TestApplyNms) {
std::vector<std::vector<float>> all_boxes = {{1, 1, 2, 2}, {3, 3, 4, 4}, {5, 5, 6, 6}, {5, 5, 6, 6}};
std::vector<float> all_scores = {0.6, 0.5, 0.4, 0.9};
@ -646,6 +697,9 @@ TEST_F(MindDataImageProcess, TestApplyNms) {
ASSERT_TRUE(keep[2] == 1);
}
/// Feature: Affine
/// Description: Test Affine with invalid inputs
/// Expectation: Throw correct error and message
TEST_F(MindDataImageProcess, TestAffineInput) {
LiteMat src(3, 3);
LiteMat dst;
@ -655,6 +709,9 @@ TEST_F(MindDataImageProcess, TestAffineInput) {
EXPECT_FALSE(Affine(src, dst, M, {0, 0}, UINT8_C1(0)));
}
/// Feature: Affine
/// Description: Test Affine basic usage
/// Expectation: Output is equal to the expected output
TEST_F(MindDataImageProcess, TestAffine) {
// The input matrix
// 0 0 1 0 0
@ -718,6 +775,9 @@ TEST_F(MindDataImageProcess, TestAffine) {
}
}
/// Feature: Subtract
/// Description: Test Subtract on dataset with LDataType::UINT8
/// Expectation: Output is equal to the expected output
TEST_F(MindDataImageProcess, TestSubtractUint8) {
const size_t cols = 4;
// Test uint8
@ -737,6 +797,9 @@ TEST_F(MindDataImageProcess, TestSubtractUint8) {
}
}
/// Feature: Subtract
/// Description: Test Subtract on dataset with LDataType::INT8
/// Expectation: Output is equal to the expected output
TEST_F(MindDataImageProcess, TestSubtractInt8) {
const size_t cols = 4;
// Test int8
@ -755,6 +818,9 @@ TEST_F(MindDataImageProcess, TestSubtractInt8) {
}
}
/// Feature: Subtract
/// Description: Test Subtract on dataset with LDataType::UINT16
/// Expectation: Output is equal to the expected output
TEST_F(MindDataImageProcess, TestSubtractUInt16) {
const size_t cols = 4;
// Test uint16
@ -774,6 +840,9 @@ TEST_F(MindDataImageProcess, TestSubtractUInt16) {
}
}
/// Feature: Subtract
/// Description: Test Subtract on dataset with LDataType::INT16
/// Expectation: Output is equal to the expected output
TEST_F(MindDataImageProcess, TestSubtractInt16) {
const size_t cols = 4;
// Test int16
@ -793,6 +862,9 @@ TEST_F(MindDataImageProcess, TestSubtractInt16) {
}
}
/// Feature: Subtract
/// Description: Test Subtract on dataset with LDataType::UINT32
/// Expectation: Output is equal to the expected output
TEST_F(MindDataImageProcess, TestSubtractUInt32) {
const size_t cols = 4;
// Test uint16
@ -812,6 +884,9 @@ TEST_F(MindDataImageProcess, TestSubtractUInt32) {
}
}
/// Feature: Subtract
/// Description: Test Subtract on dataset with LDataType::INT32
/// Expectation: Output is equal to the expected output
TEST_F(MindDataImageProcess, TestSubtractInt32) {
const size_t cols = 4;
// Test int32
@ -831,6 +906,9 @@ TEST_F(MindDataImageProcess, TestSubtractInt32) {
}
}
/// Feature: Subtract
/// Description: Test Subtract on dataset with LDataType::FLOAT32
/// Expectation: Output is equal to the expected output
TEST_F(MindDataImageProcess, TestSubtractFloat) {
const size_t cols = 4;
// Test float
@ -850,6 +928,9 @@ TEST_F(MindDataImageProcess, TestSubtractFloat) {
}
}
/// Feature: Divide
/// Description: Test Divide on dataset with LDataType::UINT8
/// Expectation: Output is equal to the expected output
TEST_F(MindDataImageProcess, TestDivideUint8) {
const size_t cols = 4;
// Test uint8
@ -869,6 +950,9 @@ TEST_F(MindDataImageProcess, TestDivideUint8) {
}
}
/// Feature: Divide
/// Description: Test Divide on dataset with LDataType::INT8
/// Expectation: Output is equal to the expected output
TEST_F(MindDataImageProcess, TestDivideInt8) {
const size_t cols = 4;
// Test int8
@ -887,6 +971,9 @@ TEST_F(MindDataImageProcess, TestDivideInt8) {
}
}
/// Feature: Divide
/// Description: Test Divide on dataset with LDataType::UINT16
/// Expectation: Output is equal to the expected output
TEST_F(MindDataImageProcess, TestDivideUInt16) {
const size_t cols = 4;
// Test uint16
@ -906,6 +993,9 @@ TEST_F(MindDataImageProcess, TestDivideUInt16) {
}
}
/// Feature: Divide
/// Description: Test Divide on dataset with LDataType::INT16
/// Expectation: Output is equal to the expected output
TEST_F(MindDataImageProcess, TestDivideInt16) {
const size_t cols = 4;
// Test int16
@ -925,6 +1015,9 @@ TEST_F(MindDataImageProcess, TestDivideInt16) {
}
}
/// Feature: Divide
/// Description: Test Divide on dataset with LDataType::UINT32
/// Expectation: Output is equal to the expected output
TEST_F(MindDataImageProcess, TestDivideUInt32) {
const size_t cols = 4;
// Test uint16
@ -944,6 +1037,9 @@ TEST_F(MindDataImageProcess, TestDivideUInt32) {
}
}
/// Feature: Divide
/// Description: Test Divide on dataset with LDataType::INT32
/// Expectation: Output is equal to the expected output
TEST_F(MindDataImageProcess, TestDivideInt32) {
const size_t cols = 4;
// Test int32
@ -963,6 +1059,9 @@ TEST_F(MindDataImageProcess, TestDivideInt32) {
}
}
/// Feature: Divide
/// Description: Test Divide on dataset with LDataType::FLOAT32
/// Expectation: Output is equal to the expected output
TEST_F(MindDataImageProcess, TestDivideFloat) {
const size_t cols = 4;
// Test float
@ -982,6 +1081,9 @@ TEST_F(MindDataImageProcess, TestDivideFloat) {
}
}
/// Feature: Multiply
/// Description: Test Multiply on dataset with LDataType::UINT8
/// Expectation: Output is equal to the expected output
TEST_F(MindDataImageProcess, TestMultiplyUint8) {
const size_t cols = 4;
// Test uint8
@ -1001,6 +1103,9 @@ TEST_F(MindDataImageProcess, TestMultiplyUint8) {
}
}
/// Feature: Multiply
/// Description: Test Multiply on dataset with LDataType::UINT16
/// Expectation: Output is equal to the expected output
TEST_F(MindDataImageProcess, TestMultiplyUInt16) {
const size_t cols = 4;
// Test int16
@ -1020,6 +1125,9 @@ TEST_F(MindDataImageProcess, TestMultiplyUInt16) {
}
}
/// Feature: Multiply
/// Description: Test Multiply on dataset with LDataType::FLOAT32
/// Expectation: Output is equal to the expected output
TEST_F(MindDataImageProcess, TestMultiplyFloat) {
const size_t cols = 4;
// Test float
@ -1039,6 +1147,9 @@ TEST_F(MindDataImageProcess, TestMultiplyFloat) {
}
}
/// Feature: ExtractChannel
/// Description: Test ExtractChannel with invalid LiteMat
/// Expectation: Throw correct error and message
TEST_F(MindDataImageProcess, TestExtractChannel) {
LiteMat lite_single;
LiteMat lite_mat = LiteMat(1, 4, 3, LDataType::UINT16);
@ -1046,6 +1157,10 @@ TEST_F(MindDataImageProcess, TestExtractChannel) {
EXPECT_FALSE(ExtractChannel(lite_mat, lite_single, 0));
EXPECT_TRUE(lite_single.IsEmpty());
}
/// Feature: GetROI
/// Description: Test GetROI using image with 3 channels
/// Expectation: Output is equal to the expected output
TEST_F(MindDataImageProcess, testROI3C) {
std::string filename = "data/dataset/apple.jpg";
cv::Mat src_image = cv::imread(filename, cv::ImreadModes::IMREAD_COLOR);
@ -1076,6 +1191,9 @@ TEST_F(MindDataImageProcess, testROI3C) {
cv::imwrite("./lite_roi.jpg", dst_imageR);
}
/// Feature: GetROI
/// Description: Test GetROI using image with 3 channels with invalid inputs
/// Expectation: Throw correct error and message
TEST_F(MindDataImageProcess, testROI3CFalse) {
std::string filename = "data/dataset/apple.jpg";
cv::Mat src_image = cv::imread(filename, cv::ImreadModes::IMREAD_COLOR);
@ -1094,6 +1212,9 @@ TEST_F(MindDataImageProcess, testROI3CFalse) {
EXPECT_FALSE(ret);
}
/// Feature: GetROI
/// Description: Test GetROI using gray image
/// Expectation: Output is equal to the expected output
TEST_F(MindDataImageProcess, testROI1C) {
std::string filename = "data/dataset/apple.jpg";
cv::Mat src_image = cv::imread(filename, cv::ImreadModes::IMREAD_COLOR);
@ -1129,7 +1250,9 @@ TEST_F(MindDataImageProcess, testROI1C) {
cv::imwrite("./lite_roi.jpg", dst_imageR);
}
// warp
/// Feature: WarpAffine
/// Description: Test WarpAffine on BGR image
/// Expectation: Output is equal to the expected output
TEST_F(MindDataImageProcess, testWarpAffineBGR) {
std::string filename = "data/dataset/apple.jpg";
cv::Mat src_image = cv::imread(filename, cv::ImreadModes::IMREAD_COLOR);
@ -1169,6 +1292,9 @@ TEST_F(MindDataImageProcess, testWarpAffineBGR) {
cv::imwrite("./warpAffine_lite_bgr.png", dst_imageR);
}
/// Feature: WarpAffine
/// Description: Test WarpAffine on BGR image with scale
/// Expectation: Output is equal to the expected output
TEST_F(MindDataImageProcess, testWarpAffineBGRScale) {
std::string filename = "data/dataset/apple.jpg";
cv::Mat src_image = cv::imread(filename, cv::ImreadModes::IMREAD_COLOR);
@ -1208,6 +1334,9 @@ TEST_F(MindDataImageProcess, testWarpAffineBGRScale) {
cv::imwrite("./warpAffine_lite_bgr_scale.png", dst_imageR);
}
/// Feature: WarpAffine
/// Description: Test WarpAffine on BGR image with resize
/// Expectation: Output is equal to the expected output
TEST_F(MindDataImageProcess, testWarpAffineBGRResize) {
std::string filename = "data/dataset/apple.jpg";
cv::Mat src_image = cv::imread(filename, cv::ImreadModes::IMREAD_COLOR);
@ -1247,6 +1376,9 @@ TEST_F(MindDataImageProcess, testWarpAffineBGRResize) {
cv::imwrite("./warpAffine_lite_bgr_resize.png", dst_imageR);
}
/// Feature: WarpAffine
/// Description: Test WarpAffine on gray image
/// Expectation: Output is equal to the expected output
TEST_F(MindDataImageProcess, testWarpAffineGray) {
std::string filename = "data/dataset/apple.jpg";
cv::Mat src_image = cv::imread(filename, cv::ImreadModes::IMREAD_COLOR);
@ -1291,6 +1423,9 @@ TEST_F(MindDataImageProcess, testWarpAffineGray) {
cv::imwrite("./warpAffine_lite_gray.png", dst_imageR);
}
/// Feature: WarpPerspective
/// Description: Test WarpPerspective on BGR image with resize
/// Expectation: Output is equal to the expected output
TEST_F(MindDataImageProcess, testWarpPerspectiveBGRResize) {
std::string filename = "data/dataset/apple.jpg";
cv::Mat src_image = cv::imread(filename, cv::ImreadModes::IMREAD_COLOR);
@ -1338,6 +1473,9 @@ TEST_F(MindDataImageProcess, testWarpPerspectiveBGRResize) {
cv::imwrite("./warpPerspective_lite_bgr.png", dst_imageR);
}
/// Feature: WarpPerspective
/// Description: Test WarpPerspective on gray image with resize
/// Expectation: Output is equal to the expected output
TEST_F(MindDataImageProcess, testWarpPerspectiveGrayResize) {
std::string filename = "data/dataset/apple.jpg";
cv::Mat src_image = cv::imread(filename, cv::ImreadModes::IMREAD_COLOR);
@ -1390,6 +1528,9 @@ TEST_F(MindDataImageProcess, testWarpPerspectiveGrayResize) {
cv::imwrite("./warpPerspective_lite_gray.png", dst_imageR);
}
/// Feature: GetRotationMatrix2D
/// Description: Test GetRotationMatrix2D basic usage
/// Expectation: Output is equal to the expected output
TEST_F(MindDataImageProcess, testGetRotationMatrix2D) {
std::vector<std::vector<double>> expect_matrix = {{0.250000, 0.433013, -0.116025}, {-0.433013, 0.250000, 1.933013}};
@ -1403,6 +1544,9 @@ TEST_F(MindDataImageProcess, testGetRotationMatrix2D) {
AccuracyComparison(expect_matrix, M);
}
/// Feature: GetPerspectiveTransform
/// Description: Test GetPerspectiveTransform basic usage
/// Expectation: Output is equal to the expected output
TEST_F(MindDataImageProcess, testGetPerspectiveTransform) {
std::vector<std::vector<double>> expect_matrix = {
{1.272113, 3.665216, -788.484287}, {-0.394146, 3.228247, -134.009780}, {-0.001460, 0.006414, 1}};
@ -1417,6 +1561,9 @@ TEST_F(MindDataImageProcess, testGetPerspectiveTransform) {
AccuracyComparison(expect_matrix, M);
}
/// Feature: GetPerspectiveTransform
/// Description: Test GetPerspectiveTransform with invalid src and dst pairs
/// Expectation: Throw correct error and message
TEST_F(MindDataImageProcess, testGetPerspectiveTransformFail) {
std::vector<Point> src = {Point(165, 270), Point(835, 270), Point(360, 125), Point(615, 125)};
std::vector<Point> dst = {Point(100, 100), Point(500, 30)};
@ -1433,6 +1580,9 @@ TEST_F(MindDataImageProcess, testGetPerspectiveTransformFail) {
EXPECT_FALSE(ret1);
}
/// Feature: GetAffineTransform
/// Description: Test GetAffineTransform basic usage
/// Expectation: Output is equal to the expected output
TEST_F(MindDataImageProcess, testGetAffineTransform) {
std::vector<std::vector<double>> expect_matrix = {{0.400000, 0.066667, 16.666667}, {0.000000, 0.333333, 23.333333}};
@ -1446,6 +1596,9 @@ TEST_F(MindDataImageProcess, testGetAffineTransform) {
AccuracyComparison(expect_matrix, M);
}
/// Feature: GetAffineTransform
/// Description: Test GetAffineTransform with invalid src and dst pairs
/// Expectation: Throw correct error and message
TEST_F(MindDataImageProcess, testGetAffineTransformFail) {
std::vector<Point> src = {Point(50, 50), Point(200, 50)};
std::vector<Point> dst = {Point(40, 40), Point(100, 40), Point(50, 90)};
@ -1462,6 +1615,9 @@ TEST_F(MindDataImageProcess, testGetAffineTransformFail) {
EXPECT_FALSE(ret1);
}
/// Feature: Conv2D
/// Description: Test Conv2D on LDataType::UINT8
/// Expectation: Output is equal to the expected output
TEST_F(MindDataImageProcess, TestConv2D8U) {
LiteMat lite_mat_src;
lite_mat_src.Init(3, 3, 1, LDataType::UINT8);
@ -1490,6 +1646,9 @@ TEST_F(MindDataImageProcess, TestConv2D8U) {
EXPECT_EQ(distance, 0.0f);
}
/// Feature: Conv2D
/// Description: Test Conv2D on LDataType::FLOAT32
/// Expectation: Output is equal to the expected output
TEST_F(MindDataImageProcess, TestConv2D32F) {
LiteMat lite_mat_src;
lite_mat_src.Init(2, 2, 1, LDataType::FLOAT32);
@ -1518,6 +1677,9 @@ TEST_F(MindDataImageProcess, TestConv2D32F) {
EXPECT_EQ(distance, 0.0f);
}
/// Feature: GaussianBlur
/// Description: Test GaussianBlur with Size(3, 5)
/// Expectation: Output is equal to the expected output
TEST_F(MindDataImageProcess, TestGaussianBlurSize35) {
std::string filename = "data/dataset/apple.jpg";
cv::Mat src_image = cv::imread(filename, cv::ImreadModes::IMREAD_COLOR);
@ -1546,6 +1708,9 @@ TEST_F(MindDataImageProcess, TestGaussianBlurSize35) {
EXPECT_LE(distance, 1.0f);
}
/// Feature: GaussianBlur
/// Description: Test GaussianBlur with Size(1, 3)
/// Expectation: Output is equal to the expected output
TEST_F(MindDataImageProcess, TestGaussianBlurSize13) {
std::string filename = "data/dataset/apple.jpg";
cv::Mat src_image = cv::imread(filename, cv::ImreadModes::IMREAD_COLOR);
@ -1574,6 +1739,9 @@ TEST_F(MindDataImageProcess, TestGaussianBlurSize13) {
EXPECT_LE(distance, 1.0f);
}
/// Feature: GaussianBlur
/// Description: Test GaussianBlur with invalid parameters
/// Expectation: Throw correct error and message
TEST_F(MindDataImageProcess, TestGaussianBlurInvalidParams) {
std::string filename = "data/dataset/apple.jpg";
cv::Mat src_image = cv::imread(filename, cv::ImreadModes::IMREAD_COLOR);
@ -1604,6 +1772,9 @@ TEST_F(MindDataImageProcess, TestGaussianBlurInvalidParams) {
ASSERT_TRUE(ret == false);
}
/// Feature: Canny
/// Description: Test Canny with aperture_size=3
/// Expectation: Output is equal to the expected output
TEST_F(MindDataImageProcess, TestCannySize3) {
std::string filename = "data/dataset/apple.jpg";
cv::Mat src_image = cv::imread(filename, cv::ImreadModes::IMREAD_COLOR);
@ -1633,6 +1804,9 @@ TEST_F(MindDataImageProcess, TestCannySize3) {
EXPECT_EQ(distance, 0.0f);
}
/// Feature: Canny
/// Description: Test Canny with aperture_size=5
/// Expectation: Output is equal to the expected output
TEST_F(MindDataImageProcess, TestCannySize5) {
std::string filename = "data/dataset/apple.jpg";
cv::Mat src_image = cv::imread(filename, cv::ImreadModes::IMREAD_COLOR);
@ -1662,6 +1836,9 @@ TEST_F(MindDataImageProcess, TestCannySize5) {
EXPECT_EQ(distance, 0.0f);
}
/// Feature: Canny
/// Description: Test Canny with aperture_size=7
/// Expectation: Output is equal to the expected output
TEST_F(MindDataImageProcess, TestCannySize7) {
std::string filename = "data/dataset/apple.jpg";
cv::Mat src_image = cv::imread(filename, cv::ImreadModes::IMREAD_COLOR);
@ -1691,6 +1868,9 @@ TEST_F(MindDataImageProcess, TestCannySize7) {
EXPECT_EQ(distance, 0.0f);
}
/// Feature: Canny
/// Description: Test Canny with L2Gradient
/// Expectation: Output is equal to the expected output
TEST_F(MindDataImageProcess, TestCannyL2) {
std::string filename = "data/dataset/apple.jpg";
cv::Mat src_image = cv::imread(filename, cv::ImreadModes::IMREAD_COLOR);
@ -1721,6 +1901,9 @@ TEST_F(MindDataImageProcess, TestCannyL2) {
EXPECT_EQ(distance, 0.0f);
}
/// Feature: Canny
/// Description: Test Canny with invalid parameters
/// Expectation: Throw correct error and message
TEST_F(MindDataImageProcess, TestCannyInvalidParams) {
std::string filename = "data/dataset/apple.jpg";
cv::Mat src_image = cv::imread(filename, cv::ImreadModes::IMREAD_COLOR);
@ -1761,6 +1944,9 @@ TEST_F(MindDataImageProcess, TestCannyInvalidParams) {
ASSERT_TRUE(ret == false);
}
/// Feature: Sobel
/// Description: Test Sobel with one of dx or dy = 0 with default ksize, scale, and delta
/// Expectation: Output is equal to the expected output
TEST_F(MindDataImageProcess, TestSobel) {
std::string filename = "data/dataset/apple.jpg";
cv::Mat src_image = cv::imread(filename, cv::ImreadModes::IMREAD_COLOR);
@ -1807,6 +1993,9 @@ TEST_F(MindDataImageProcess, TestSobel) {
EXPECT_EQ(distance_y, 0.0f);
}
/// Feature: Sobel
/// Description: Test Sobel with dx and dy > 0 with ksize=5
/// Expectation: Output is equal to the expected output
TEST_F(MindDataImageProcess, TestSobelFlag) {
std::string filename = "data/dataset/apple.jpg";
cv::Mat src_image = cv::imread(filename, cv::ImreadModes::IMREAD_COLOR);
@ -1843,6 +2032,9 @@ TEST_F(MindDataImageProcess, TestSobelFlag) {
EXPECT_EQ(distance_x, 0.0f);
}
/// Feature: ConvertRgbToBgr
/// Description: Test ConvertRgbToBgr basic usage
/// Expectation: Output is equal to the expected output
TEST_F(MindDataImageProcess, testConvertRgbToBgr) {
std::string filename = "data/dataset/apple.jpg";
cv::Mat image = cv::imread(filename, cv::ImreadModes::IMREAD_COLOR);
@ -1861,6 +2053,9 @@ TEST_F(MindDataImageProcess, testConvertRgbToBgr) {
CompareMat(image, lite_mat_bgr);
}
/// Feature: ConvertRgbToBgr
/// Description: Test ConvertRgbToBgr with invalid inputs
/// Expectation: Throw correct error and message
TEST_F(MindDataImageProcess, testConvertRgbToBgrFail) {
std::string filename = "data/dataset/apple.jpg";
cv::Mat image = cv::imread(filename, cv::ImreadModes::IMREAD_COLOR);
@ -1882,6 +2077,9 @@ TEST_F(MindDataImageProcess, testConvertRgbToBgrFail) {
ASSERT_TRUE(ret1 == false);
}
/// Feature: ConvertRgbToGray
/// Description: Test ConvertRgbToGray basic usage
/// Expectation: Output is equal to the expected output
TEST_F(MindDataImageProcess, testConvertRgbToGray) {
std::string filename = "data/dataset/apple.jpg";
cv::Mat image = cv::imread(filename, cv::ImreadModes::IMREAD_COLOR);
@ -1904,6 +2102,9 @@ TEST_F(MindDataImageProcess, testConvertRgbToGray) {
CompareMat(rgb_mat, lite_mat_gray);
}
/// Feature: ConvertRgbToGray
/// Description: Test ConvertRgbToGray with invalid inputs
/// Expectation: Throw correct error and message
TEST_F(MindDataImageProcess, testConvertRgbToGrayFail) {
std::string filename = "data/dataset/apple.jpg";
cv::Mat image = cv::imread(filename, cv::ImreadModes::IMREAD_COLOR);
@ -1937,6 +2138,9 @@ TEST_F(MindDataImageProcess, testConvertRgbToGrayFail) {
ASSERT_TRUE(ret2 == false);
}
/// Feature: ResizePreserveARWithFiller
/// Description: Test ResizePreserveARWithFiller basic usage
/// Expectation: Output is equal to the expected output
TEST_F(MindDataImageProcess, testResizePreserveARWithFillerv) {
std::string filename = "data/dataset/apple.jpg";
cv::Mat image = cv::imread(filename, cv::ImreadModes::IMREAD_COLOR);
@ -1954,6 +2158,9 @@ TEST_F(MindDataImageProcess, testResizePreserveARWithFillerv) {
cv::imwrite("./mindspore_image.jpg", dst_image);
}
/// Feature: ResizePreserveARWithFiller
/// Description: Test ResizePreserveARWithFiller with invalid inputs
/// Expectation: Throw correct error and message
TEST_F(MindDataImageProcess, testResizePreserveARWithFillervFail) {
std::string filename = "data/dataset/apple.jpg";
cv::Mat image = cv::imread(filename, cv::ImreadModes::IMREAD_COLOR);
@ -2002,7 +2209,7 @@ TEST_F(MindDataImageProcess, testResizePreserveARWithFillervFail) {
/// Feature: Test HWCTOCHW Operation successfully.
/// Description: The input is a three-dimensional int array.
/// Expectation: success and The final result should be consistent with expect_value_arr.
/// Expectation: Success and The final result should be consistent with expect_value_arr.
TEST_F(MindDataImageProcess, TestHWCTOCHW) {
std::vector<int32_t> a = {1, 2, 3, 4, 5, 6};
LiteMat src(1, 2, 3, a.data(), LDataType(LDataType::INT32));
@ -2020,7 +2227,7 @@ TEST_F(MindDataImageProcess, TestHWCTOCHW) {
/// Feature: Test HWCTOCHW Operation successfully.
/// Description: The input is a three channel picture.
/// Expectation: success and The final result should be consistent with expect_value.
/// Expectation: Success and The final result should be consistent with expect_value.
TEST_F(MindDataImageProcess, TestHWCTOCHWImage) {
std::string filename = "data/dataset/apple.jpg";
cv::Mat image = cv::imread(filename, cv::ImreadModes::IMREAD_COLOR);

View File

@ -1,5 +1,5 @@
/**
* Copyright 2020-2021 Huawei Technologies Co., Ltd
* Copyright 2020-2022 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -138,6 +138,9 @@ class MindDataTestCallback : public UT::DatasetOpTesting {
GlobalInit();
}
/// Feature: Callback
/// Description: Test basic callbacks with mappable dataset (RandomDataset)
/// Expectation: Number and order of callbacks generated are correct
void TestBasicCallback(std::shared_ptr<ExecutionTree> tree, std::shared_ptr<DatasetOp> callback_node,
int32_t step_size) {
// config callback
@ -213,7 +216,7 @@ class MindDataTestCallback : public UT::DatasetOpTesting {
/// Feature: Callback
/// Description: Test callbacks with mappable dataset (RandomDataset)
/// Expectation: number and order of callbacks generated are correct
/// Expectation: Number and order of callbacks generated are correct
TEST_F(MindDataTestCallback, TestBasicCallback) {
MS_LOG(INFO) << "Doing: MindDataTestCallback-TestBasicCallback";
// Test Mapop
@ -230,6 +233,9 @@ TEST_F(MindDataTestCallback, TestBasicCallback) {
TestBasicCallback(tree, nodes[2], 64);
}
/// Feature: Callback
/// Description: Test callbacks with multiple epochs
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestCallback, TestMultiEpochCallback) {
MS_LOG(INFO) << "Doing: MindDataTestCallback-TestMultiEpochCallback";
// config callback
@ -300,6 +306,9 @@ TEST_F(MindDataTestCallback, TestMultiEpochCallback) {
EXPECT_EQ(tst_cb->all_step_nums(len), all_steps);
}
/// Feature: Callback
/// Description: Test selected callbacks and turning off the epochs
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestCallback, TestSelectedCallback) {
MS_LOG(INFO) << "Doing: MindDataTestCallback-TestSelectedCallback";
// config callback
@ -343,6 +352,9 @@ TEST_F(MindDataTestCallback, TestSelectedCallback) {
EXPECT_EQ(tst_cb->all_step_nums(len), all_steps);
}
/// Feature: Callback
/// Description: Test Cpp API callbacks and disabling IR optimization pass and use tree_adapter to set num_epochs=1
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestCallback, TestCAPICallback) {
MS_LOG(INFO) << "Doing: MindDataTestCallback-TestCAPICallback";
// config callback

View File

@ -69,72 +69,88 @@ class MindDataTestIRVision : public UT::DatasetOpTesting {
MindDataTestIRVision() = default;
};
/// Feature: AutoContrast op
/// Description: Test AutoContrast op with invalid cutoff
/// Expectation: Throw correct error and message
TEST_F(MindDataTestIRVision, TestAutoContrastFail1) {
MS_LOG(INFO) << "Doing MindDataTestIRVision-TestAutoContrastFail1.";
// Testing invalid cutoff < 0
std::shared_ptr<TensorOperation> auto_contrast1(new vision::AutoContrastOperation(-1.0, {}));
auto auto_contrast1 = std::make_shared<vision::AutoContrastOperation>(-1.0, std::vector<uint32_t>{});
Status rc1 = auto_contrast1->ValidateParams();
EXPECT_ERROR(rc1);
// Testing invalid cutoff > 100
std::shared_ptr<TensorOperation> auto_contrast2(new vision::AutoContrastOperation(110.0, {10, 20}));
auto auto_contrast2 = std::make_shared<vision::AutoContrastOperation>(110.0, std::vector<uint32_t>{10, 20});
Status rc2 = auto_contrast2->ValidateParams();
EXPECT_ERROR(rc2);
}
/// Feature: CenterCrop op
/// Description: Test CenterCrop op with invalid parameters
/// Expectation: Throw correct error and message
TEST_F(MindDataTestIRVision, TestCenterCropFail) {
MS_LOG(INFO) << "Doing MindDataTestIRVision-TestCenterCrop with invalid parameters.";
Status rc;
// center crop height value negative
std::shared_ptr<TensorOperation> center_crop1(new vision::CenterCropOperation({-32, 32}));
auto center_crop1 = std::make_shared<vision::CenterCropOperation>(std::vector<int32_t>{-32, 32});
rc = center_crop1->ValidateParams();
EXPECT_ERROR(rc);
// center crop width value negative
std::shared_ptr<TensorOperation> center_crop2(new vision::CenterCropOperation({32, -32}));
auto center_crop2 = std::make_shared<vision::CenterCropOperation>(std::vector<int32_t>{32, -32});
rc = center_crop2->ValidateParams();
EXPECT_ERROR(rc);
// 0 value would result in nullptr
std::shared_ptr<TensorOperation> center_crop3(new vision::CenterCropOperation({0, 32}));
auto center_crop3 = std::make_shared<vision::CenterCropOperation>(std::vector<int32_t>{0, 32});
rc = center_crop3->ValidateParams();
EXPECT_ERROR(rc);
// center crop with 3 values
std::shared_ptr<TensorOperation> center_crop4(new vision::CenterCropOperation({10, 20, 30}));
auto center_crop4 = std::make_shared<vision::CenterCropOperation>(std::vector<int32_t>{10, 20, 30});
rc = center_crop4->ValidateParams();
EXPECT_ERROR(rc);
}
/// Feature: Crop op
/// Description: Test Crop op with invalid parameters
/// Expectation: Throw correct error and message
TEST_F(MindDataTestIRVision, TestCropFail) {
MS_LOG(INFO) << "Doing MindDataTestIRVision-TestCrop with invalid parameters.";
Status rc;
// wrong width
std::shared_ptr<TensorOperation> crop1(new vision::CropOperation({0, 0}, {32, -32}));
auto crop1 = std::make_shared<vision::CropOperation>(
std::vector<int32_t>{0, 0}, std::vector<int32_t>{32, -32});
rc = crop1->ValidateParams();
EXPECT_ERROR(rc);
// wrong height
std::shared_ptr<TensorOperation> crop2(new vision::CropOperation({0, 0}, {-32, -32}));
auto crop2 = std::make_shared<vision::CropOperation>(
std::vector<int32_t>{0, 0}, std::vector<int32_t>{-32, -32});
rc = crop2->ValidateParams();
EXPECT_ERROR(rc);
// zero height
std::shared_ptr<TensorOperation> crop3(new vision::CropOperation({0, 0}, {0, 32}));
auto crop3 = std::make_shared<vision::CropOperation>(
std::vector<int32_t>{0, 0}, std::vector<int32_t>{0, 32});
rc = crop3->ValidateParams();
EXPECT_ERROR(rc);
// negative coordinates
std::shared_ptr<TensorOperation> crop4(new vision::CropOperation({-1, 0}, {32, 32}));
auto crop4 = std::make_shared<vision::CropOperation>(
std::vector<int32_t>{-1, 0}, std::vector<int32_t>{32, 32});
rc = crop4->ValidateParams();
EXPECT_ERROR(rc);
}
/// Feature: CutOut op
/// Description: Test CutOut op with invalid parameters (negative length and number of patches)
/// Expectation: Throw correct error and message
TEST_F(MindDataTestIRVision, TestCutOutFail1) {
MS_LOG(INFO) << "Doing MindDataTestIRVision-TestCutOutFail1 with invalid parameters.";
@ -152,6 +168,9 @@ TEST_F(MindDataTestIRVision, TestCutOutFail1) {
EXPECT_ERROR(rc);
}
/// Feature: CutOut op
/// Description: Test CutOut op with invalid parameters (zero length and number of patches)
/// Expectation: Throw correct error and message
TEST_F(MindDataTestIRVision, TestCutOutFail2) {
MS_LOG(INFO) << "Doing MindDataTestIRVision-TestCutOutFail2 with invalid params, boundary cases.";
@ -170,8 +189,8 @@ TEST_F(MindDataTestIRVision, TestCutOutFail2) {
}
/// Feature: Normalize op
/// Description: test invalid input parameters at IR level
/// Expectation: throw correct error and message
/// Description: Test invalid input parameters at IR level
/// Expectation: Throw correct error and message
TEST_F(MindDataTestIRVision, TestNormalizeFail) {
MS_LOG(INFO) << "Doing MindDataTestIRVision-TestNormalizeFail with invalid parameters.";
@ -223,8 +242,8 @@ TEST_F(MindDataTestIRVision, TestNormalizeFail) {
}
/// Feature: NormalizePad op
/// Description: test invalid input parameters at IR level
/// Expectation: throw correct error and message
/// Description: Test invalid input parameters at IR level
/// Expectation: Throw correct error and message
TEST_F(MindDataTestIRVision, TestNormalizePadFail) {
MS_LOG(INFO) << "Doing MindDataTestIRVision-TestNormalizePadFail with invalid parameters.";
@ -265,72 +284,87 @@ TEST_F(MindDataTestIRVision, TestNormalizePadFail) {
EXPECT_ERROR(rc);
}
/// Feature: Rescale op
/// Description: Test Rescale op with negative rescale parameter
/// Expectation: Throw correct error and message
TEST_F(MindDataTestIRVision, TestRescaleFail) {
MS_LOG(INFO) << "Doing MindDataTestIRVision-TestRescaleFail with invalid params.";
Status rc;
// incorrect negative rescale parameter
std::shared_ptr<TensorOperation> rescale(new vision::RescaleOperation(-1.0, 0.0));
auto rescale = std::make_shared<vision::RescaleOperation>(-1.0, 0.0);
rc = rescale->ValidateParams();
EXPECT_ERROR(rc);
}
/// Feature: Resize op
/// Description: Test Resize op with invalid resize values
/// Expectation: Throw correct error and message
TEST_F(MindDataTestIRVision, TestResizeFail) {
MS_LOG(INFO) << "Doing MindDataTestIRVision-TestResize with invalid parameters.";
Status rc;
// negative resize value
std::shared_ptr<TensorOperation> resize_op1(new vision::ResizeOperation({30, -30}, InterpolationMode::kLinear));
auto resize_op1 = std::make_shared<vision::ResizeOperation>(
std::vector<int32_t>{30, -30}, InterpolationMode::kLinear);
rc = resize_op1->ValidateParams();
EXPECT_ERROR(rc);
// zero resize value
std::shared_ptr<TensorOperation> resize_op2(new vision::ResizeOperation({0, 30}, InterpolationMode::kLinear));
auto resize_op2 = std::make_shared<vision::ResizeOperation>(
std::vector<int32_t>{0, 30}, InterpolationMode::kLinear);
rc = resize_op2->ValidateParams();
EXPECT_ERROR(rc);
// resize with 3 values
std::shared_ptr<TensorOperation> resize_op3(new vision::ResizeOperation({30, 20, 10}, InterpolationMode::kLinear));
auto resize_op3 = std::make_shared<vision::ResizeOperation>(
std::vector<int32_t>{30, 20, 10}, InterpolationMode::kLinear);
rc = resize_op3->ValidateParams();
EXPECT_ERROR(rc);
}
/// Feature: ResizeWithBBox op
/// Description: Test ResizeWithBBox op with invalid resize values
/// Expectation: Throw correct error and message
TEST_F(MindDataTestIRVision, TestResizeWithBBoxFail) {
MS_LOG(INFO) << "Doing MindDataTestIRVision-TestResizeWithBBoxFail with invalid parameters.";
Status rc;
// Testing negative resize value
std::shared_ptr<TensorOperation> resize_with_bbox_op(
new vision::ResizeWithBBoxOperation({10, -10}, InterpolationMode::kLinear));
auto resize_with_bbox_op = std::make_shared<vision::ResizeWithBBoxOperation>(
std::vector<int32_t>{10, -10}, InterpolationMode::kLinear);
EXPECT_NE(resize_with_bbox_op, nullptr);
rc = resize_with_bbox_op->ValidateParams();
EXPECT_ERROR(rc);
// Testing negative resize value
std::shared_ptr<TensorOperation> resize_with_bbox_op1(
new vision::ResizeWithBBoxOperation({-10}, InterpolationMode::kLinear));
auto resize_with_bbox_op1 = std::make_shared<vision::ResizeWithBBoxOperation>(
std::vector<int32_t>{-10}, InterpolationMode::kLinear);
EXPECT_NE(resize_with_bbox_op1, nullptr);
rc = resize_with_bbox_op1->ValidateParams();
EXPECT_ERROR(rc);
// Testing zero resize value
std::shared_ptr<TensorOperation> resize_with_bbox_op2(
new vision::ResizeWithBBoxOperation({0, 10}, InterpolationMode::kLinear));
auto resize_with_bbox_op2 = std::make_shared<vision::ResizeWithBBoxOperation>(
std::vector<int32_t>{0, 10}, InterpolationMode::kLinear);
EXPECT_NE(resize_with_bbox_op2, nullptr);
rc = resize_with_bbox_op2->ValidateParams();
EXPECT_ERROR(rc);
// Testing resize with 3 values
std::shared_ptr<TensorOperation> resize_with_bbox_op3(
new vision::ResizeWithBBoxOperation({10, 10, 10}, InterpolationMode::kLinear));
auto resize_with_bbox_op3 = std::make_shared<vision::ResizeWithBBoxOperation>(
std::vector<int32_t>{10, 10, 10}, InterpolationMode::kLinear);
EXPECT_NE(resize_with_bbox_op3, nullptr);
rc = resize_with_bbox_op3->ValidateParams();
EXPECT_ERROR(rc);
}
/// Feature: Vision operation name
/// Description: Create a vision tensor operation and check the name
/// Expectation: Output is equal to the expected output
TEST_F(MindDataTestIRVision, TestVisionOperationName) {
MS_LOG(INFO) << "Doing MindDataTestIRVision-TestVisionOperationName.";

View File

@ -1,5 +1,5 @@
/**
* Copyright 2019-2021 Huawei Technologies Co., Ltd
* Copyright 2019-2022 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -27,6 +27,10 @@ class MindDataTestTaskManager : public UT::Common {
void SetUp() { Services::CreateInstance(); }
};
/// Feature: GetTaskErrorIfAny in TaskGroup
/// Description: Test the error is passed back to the master thread if vg_rc is OK
/// If vg_rc is kOutOfMemory, the group error is already passed back
/// Expectation: No hangs or failures
TEST_F(MindDataTestTaskManager, Test1) {
// Clear the rc of the master thread if any
(void)TaskManager::GetMasterThreadRc();
@ -50,13 +54,14 @@ TEST_F(MindDataTestTaskManager, Test1) {
}
}
/// Feature: Wait in CondVar
/// Description: This testcase will spawn about 100 threads and block on a conditional variable.
/// The master thread will try to interrupt them almost at the same time. This can
/// cause a racing condition that some threads may miss the interrupt and blocked.
/// The new logic of Task::Join() will do a time-out join and wake up all those threads that miss the interrupt
/// Clear the rc of the master thread if any
/// Expectation: No hangs or failures
TEST_F(MindDataTestTaskManager, Test2) {
// This testcase will spawn about 100 threads and block on a conditional variable.
// The master thread will try to interrupt them almost at the same time. This can
// cause a racing condition that some threads may miss the interrupt and blocked.
// The new logic of Task::Join() will do a time-out join and wake up all those
// threads that miss the interrupt.
// Clear the rc of the master thread if any
(void)TaskManager::GetMasterThreadRc();
TaskGroup vg;
CondVar cv;
@ -84,9 +89,9 @@ TEST_F(MindDataTestTaskManager, Test2) {
ASSERT_TRUE(vg.join_all(Task::WaitFlag::kNonBlocking).IsOk());
}
/// Feature: WaitFor in CondVar.
/// Description: test WaitFor function
/// Expectation: no hangs or failures
/// Feature: WaitFor in CondVar
/// Description: Test WaitFor function
/// Expectation: No hangs or failures
TEST_F(MindDataTestTaskManager, Test3) {
(void)TaskManager::GetMasterThreadRc();
TaskGroup vg;