16 #ifdef ECVL_WITH_EXAMPLES    17 #include "dataset_path.h"    21 #include <gmock/gmock.h>    22 #include <gtest/gtest.h>    26 #ifdef ECVL_WITH_EXAMPLES    27 TEST(DatasetParser, LoadExistingDataset)
    29     Dataset d(CMAKE_CURRENT_SOURCE_DIR 
"/examples/data/mnist/mnist.yml");
    30     EXPECT_EQ(d.name_, 
"MNIST");
    31     EXPECT_EQ(d.classes_.size(), 10);
    32     EXPECT_THAT(d.classes_, testing::ElementsAre(
"0", 
"1", 
"2", 
"3", 
"4", 
"5", 
"6", 
"7", 
"8", 
"9"));
    33     EXPECT_EQ(d.samples_.size(), 70000);
    37 TEST(DatasetParser, LoadNonExistingDataset)
    39     EXPECT_THROW(
Dataset d(
"idontexist"), std::runtime_error);
    42 TEST(DatasetParser, LoadNonExistingOrBadImage)
    45         std::ofstream os(
"hello.yml");
    46         os << 
"dataset: test\n"    48             "    - location: idontexist\n"    49             "      label: hello.png\n";
    52         std::ofstream os(
"hello.png");
    53         os << 
"this is not a valid image";
    56     EXPECT_THROW(d.
samples_.front().LoadImage(), std::runtime_error);
 
TEST(DatasetParser, LoadNonExistingDataset)
 
std::vector< Sample > samples_
Vector containing all the Dataset samples. See Sample.