예제 #1
0
/* Test the method 'parseColor' with a wrong String. An exception must occur.*/
TEST(RGBColor, test_parseColor_with_wrong_string) {
	ASSERT_THROW(RGBColor::parseColor("a,b,y"),NumberFormatException);
}
예제 #2
0
TEST_F(UndirectedGraphFixture, throwsOnMalformedFile)
{
    ASSERT_THROW(std::make_unique<UndirectedGraph>("/home/dec/studia/sem6/zwsisk/ZLY.txt"),
            std::runtime_error);
}
예제 #3
0
TEST_F(UndirectedGraphFixture, returnsWeightOfEdge)
{
    ASSERT_THROW(g_.getWeightOfEdge(0, 1), std::runtime_error);
    g_.addEdge(0, 1, 7);
    ASSERT_EQ(7, g_.getWeightOfEdge(0, 1));
}
예제 #4
0
TEST(DictionaryDeserialization, InvalidMarker) {
	DeserializationContext ctx;
	v8 data = { 0x10, 0x01, 0x00 };
	auto it = data.cbegin();
	ASSERT_THROW(AmfDictionary::deserialize(it, data.cend(), ctx), std::invalid_argument);
}
예제 #5
0
TEST( FileReaderConstructor , whileConstructingNegativeNumber ) {

    ASSERT_THROW(FileRecordsReader("sample1.txt",-5), exception);
}
예제 #6
0
TEST( serialise, guess_corrupted_xml )
{
    std::istringstream iss( "<name>dummy<name>" );
    config c; 
    ASSERT_THROW( comma::read< config >( c, iss ), comma::exception );
}
예제 #7
0
TEST( serialise, DISABLED_path_value_confused_with_ini_comments )
{
    config c;
    std::istringstream iss( ";comment=2" );
    ASSERT_THROW( comma::read< config >( c, iss ), comma::exception );
}
예제 #8
0
TEST_P(clustering_test, config_validation) {
  string n("name");
  map<string, string> param = GetParam();
  string m = param["method"];
  clustering_config c;
  c.compressor_method = param["compressor_method"];

  if (param["result"] == "true") {
    ASSERT_NO_THROW(clustering k(n, m, c));
  } else {
    ASSERT_THROW(clustering k(n, m, c), common::invalid_parameter);
    return;
  }

  // 1 <= k
  c.k = 0;
  ASSERT_THROW(clustering k(n, m, c), common::invalid_parameter);
  c.k = 1;
  ASSERT_NO_THROW(clustering k(n, m, c));
  c.k = 2;
  ASSERT_NO_THROW(clustering k(n, m, c));

  // 2 <= bucket_size
  c.compressed_bucket_size = 2;
  c.bicriteria_base_size = 1;
  c.bucket_size = 1;
  ASSERT_THROW(clustering k(n, m, c), common::invalid_parameter);
  // this case not will be passed;
  // (1 <= bicriteria_base_size < compressed_bucket_size < bucket_size)
  // c.bucket_size = 2;
  // ASSERT_NO_THROW(clustering k(n, m, c));
  c.bucket_size = 3;
  ASSERT_NO_THROW(clustering k(n, m, c));

  // 2 <= bucket_length
  c.bucket_length = 1;
  ASSERT_THROW(clustering k(n, m, c), common::invalid_parameter);
  c.bucket_length = 2;
  ASSERT_NO_THROW(clustering k(n, m, c));
  c.bucket_length = 3;
  ASSERT_NO_THROW(clustering k(n, m, c));

  // 1 <= bicriteria_base_size < compressed_bucket_size
  c.bucket_size = 4;
  c.compressed_bucket_size = 3;
  c.bicriteria_base_size = 0;
  ASSERT_THROW(clustering k(n, m, c), common::invalid_parameter);
  c.bicriteria_base_size = 3;
  ASSERT_THROW(clustering k(n, m, c), common::invalid_parameter);
  c.bicriteria_base_size = 4;
  ASSERT_THROW(clustering k(n, m, c), common::invalid_parameter);
  c.bicriteria_base_size = 1;
  ASSERT_NO_THROW(clustering k(n, m, c));
  c.bicriteria_base_size = 2;
  ASSERT_NO_THROW(clustering k(n, m, c));

  // compressed_bucket_size < bucket_size
  c.compressed_bucket_size = 4;
  ASSERT_THROW(clustering k(n, m, c), common::invalid_parameter);
  c.compressed_bucket_size = 5;
  ASSERT_THROW(clustering k(n, m, c), common::invalid_parameter);
  c.compressed_bucket_size = 3;
  ASSERT_NO_THROW(clustering k(n, m, c));

  // 0.0 <= forgetting_factor
  c.forgetting_factor = std::numeric_limits<double>::quiet_NaN();
  ASSERT_THROW(clustering k(n, m, c), common::invalid_parameter);
  c.forgetting_factor = -1.0;
  ASSERT_THROW(clustering k(n, m, c), common::invalid_parameter);
  c.forgetting_factor = 0.0;
  ASSERT_NO_THROW(clustering k(n, m, c));
  c.forgetting_factor = 1.0;
  ASSERT_NO_THROW(clustering k(n, m, c));

  // 0.0 <= forgetting_threshold <= 1.0
  c.forgetting_threshold = std::numeric_limits<double>::quiet_NaN();
  ASSERT_THROW(clustering k(n, m, c), common::invalid_parameter);
  c.forgetting_threshold = -1.0;
  ASSERT_THROW(clustering k(n, m, c), common::invalid_parameter);
  c.forgetting_threshold = 0.0;
  ASSERT_NO_THROW(clustering k(n, m, c));
  c.forgetting_threshold = 0.5;
  ASSERT_NO_THROW(clustering k(n, m, c));
  c.forgetting_threshold = 1.0;
  ASSERT_NO_THROW(clustering k(n, m, c));
  c.forgetting_threshold = 2.0;
  ASSERT_THROW(clustering k(n, m, c), common::invalid_parameter);
}
TEST_F(IpAddressTest, TestValidationInvalidPorts) {
    ASSERT_THROW(testSetPort(-5),     InvalidPortException);
    ASSERT_THROW(testSetPort(-9545),  InvalidPortException);
    ASSERT_THROW(testSetPort(-8599),  InvalidPortException);
}
예제 #10
0
TEST(AudioDataTest, FrameRate){
  KeyFinder::AudioData a;
  a.setFrameRate(44100);
  ASSERT_EQ(44100, a.getFrameRate());
  ASSERT_THROW(a.setFrameRate(0), KeyFinder::Exception);
}
예제 #11
0
TEST_F(JitCompilerTest, ThrowsOnInvalidSymbolLookup) {
  auto compiler = JitCompiler{};
  compiler.add_module(std::move(_module));
  ASSERT_THROW(compiler.find_symbol<void()>("some_nonexisting_symbol"), std::logic_error);
}
예제 #12
0
TEST(AudioDataTest, Channels){
  KeyFinder::AudioData a;
  a.setChannels(2);
  ASSERT_EQ(2, a.getChannels());
  ASSERT_THROW(a.setChannels(0), KeyFinder::Exception);
}
예제 #13
0
/* Test the method 'parseColor' with thrown EmptyData Exception*/
TEST(RGBColor, test_parseColor_with_a_short_string) {	
	ASSERT_THROW(RGBColor::parseColor("1,2"),EmptyData) << "Expect an EmptyData exception.";
	ASSERT_THROW(RGBColor::parseColor("test"),EmptyData) << "Expect an EmptyData exception.";
}
예제 #14
0
/* Test the method 'parseColor' with an empty String*/
TEST(RGBColor, test_parseColor_with_empty_string) {
	std::string s;	
	ASSERT_THROW(RGBColor::parseColor(s),EmptyData) << "Expect an EmptyData exception.";	
}
예제 #15
0
TEST_F(Factory_Test, throw_error_when_no_worker_for_product_is_registered)
{
  ASSERT_THROW(testee.produce("quaxli"), std::invalid_argument);
}
예제 #16
0
TEST_F(GetTableTests, get_table_fail_test) {
  GetTable gt("non_existent");
  ASSERT_THROW(gt.execute(), std::runtime_error);
}
예제 #17
0
TEST( serialise, guess_corrupted_json )
{
    std::istringstream iss( "{ \"name\": \"dummy\", }" );
    config c; 
    ASSERT_THROW( comma::read< config >( c, iss ), comma::exception );
}
예제 #18
0
TEST_F(StorageManagerTests, unbacked_table_load_results_in_exception) {
  hyrise::storage::atable_ptr_t t = std::make_shared<MutableVerticalTable>();
  sm->loadTable("LINXXS", t);
  sm->unloadTable("LINXXS");
  ASSERT_THROW(sm->preloadTable("LINXXS"), std::runtime_error);
}
예제 #19
0
TEST( serialise, guess_corrupted_path_value )
{
    config c;
    std::istringstream iss( "name/" );
    ASSERT_THROW( comma::read< config >( c, iss ), comma::exception );
}
예제 #20
0
파일: ops_select.cpp 프로젝트: JWUST/hyrise
TEST_F(SelectTests, should_throw_without_predicates) {
  Json::Value v(Json::objectValue);
  v["type"] = "SimpleTableScan";
  ASSERT_THROW(SimpleTableScan::parse(v), std::runtime_error);
}
예제 #21
0
TEST_F(NetworkTest, readCyclicNetwork){
	ASSERT_THROW(n_.readNetwork(TEST_DATA_PATH("cylicNetwork1.tgf")),std::invalid_argument);
	ASSERT_THROW(n_.readNetwork(TEST_DATA_PATH("cylicNetwork2.tgf")),std::invalid_argument);
}
TEST_F( SocketConnectionReceiverTester, ThrowsExceptionWhenAcceptFails )
{
    flags_.acceptShouldError = true;
    ASSERT_THROW( callNextConnection(), SocketAcceptException );
}
예제 #23
0
TEST( FileReaderConstructor , whileConstructingFileNotFound ) {

    ASSERT_THROW(FileRecordsReader("sample.txt",5), exception);
}
TEST_F( SocketConnectionReceiverTester, ThrowsExceptionOnErrorBind )
{
    flags_.bindShouldError = true;
    ASSERT_THROW( createAndDeleteReceiver(), SocketBindException );
}
예제 #25
0
TEST_F(UndirectedGraphFixture, throwsOnNonexistentFile)
{
    ASSERT_THROW(std::make_unique<UndirectedGraph>("/witam"),
            std::runtime_error);
}
예제 #26
0
파일: TestGrid.cpp 프로젝트: XRuiWang/ogs
TEST(GeoLib, InsertZeroPointsInGrid)
{
	std::vector<GeoLib::Point*> pnts;
	ASSERT_THROW(GeoLib::Grid<GeoLib::Point> grid(pnts.begin(), pnts.end()), std::invalid_argument);
}
예제 #27
0
TEST_F(UndirectedGraphFixture, throwsOnRemovingNonexistentEdges)
{
    ASSERT_THROW(g_.removeEdge(0, 1), std::runtime_error);
    g_.addEdge(0, 1, 7);
    ASSERT_NO_THROW(g_.removeEdge(0, 1));
}
예제 #28
0
TEST(RomanNumberTest, InvalidInput)
{
    ASSERT_THROW(RomanNumber::Decode("ABCD"), std::exception);
}
TEST(TubeSegmentation, WrongFilenameException) {
	paramList parameters = initParameters(PARAMETERS_DIR);
	ASSERT_THROW(run("somefilethatdoesntexist.mhd", parameters, KERNELS_DIR, OUL_DIR), SIPL::IOException);
}
예제 #30
0
TEST_F(PhoneBookAPITest, throwsExceptionOnInvalidId) {
    this->insertExamples();
    ASSERT_THROW(this->phoneBook->getRecordById(100), RecordIdNotFoundException);
}