• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ ASSERT_NE函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中ASSERT_NE函数的典型用法代码示例。如果您正苦于以下问题:C++ ASSERT_NE函数的具体用法?C++ ASSERT_NE怎么用?C++ ASSERT_NE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了ASSERT_NE函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: BOOST_FIXTURE_TEST_CASE

BOOST_FIXTURE_TEST_CASE(readFilePath, JsonFilePaserTestInit){
  std::string filename;
  TEST_ASSERT(jsonFile.readFilePath("filename",filename,false));
  ASSERT_NE(filename,std::string("f.txt"));
  ASSERT_EQ(filename,jsonFile.getFileDir()+std::string("f.txt"));
}
开发者ID:Tonsty,项目名称:Utility,代码行数:6,代码来源:JsonFilePaserTest.cpp


示例2: TEST

TEST(sys_mman, mremap_PTRDIFF_MAX) {
  void* map = mmap(nullptr, PAGE_SIZE, PROT_NONE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
  ASSERT_NE(MAP_FAILED, map);
  ASSERT_EQ(MAP_FAILED, mremap(map, PAGE_SIZE, kHuge, MREMAP_MAYMOVE));
}
开发者ID:multi-os-engine,项目名称:platform_bionic,代码行数:5,代码来源:sys_mman_test.cpp


示例3: TEST

TEST(SocketTests, ClientServer) {
    int fd_socket, fd_connect;
    int port, res;
    pid_t child;
    socklen_t size;
    struct sockaddr_in saddr = {};
    char buf[512];

    saddr.sin_family = AF_INET;
    saddr.sin_addr.s_addr = INADDR_ANY;
    /* use 0 so the kernel assigns us an open port # */
    saddr.sin_port = htons(0);

    fd_socket = socket(AF_INET, SOCK_STREAM, 0);
    ASSERT_NE(fd_socket, -1);
    res = bind(fd_socket, (struct sockaddr *) &saddr, sizeof(saddr));
    ASSERT_NE(res, -1);
    res = listen(fd_socket, 16/*max queue length*/);
    ASSERT_NE(res, -1);

    /* get the port # we were assigned */
    size = sizeof(saddr);
    res = getsockname(fd_socket, (struct sockaddr *) &saddr, &size);
    ASSERT_NE(res, -1);
    port = ntohs(saddr.sin_port);

    child = fork();
    ASSERT_TRUE(child >= 0);
    if (child == 0) {
        struct sockaddr from_addr;
        socklen_t from_len = sizeof(from_addr);
        int fd_client;
        struct hostent *hp = gethostbyname("localhost");
        ASSERT_NE(hp, (struct hostent *)NULL);

        memset(&saddr, 0, sizeof(saddr));
        saddr.sin_family = AF_INET;
        saddr.sin_addr.s_addr = ((struct in_addr *)(hp->h_addr))->s_addr;
        saddr.sin_port = htons(port);

        /* connect and exchange greetings */
        fd_client = socket(AF_INET, SOCK_STREAM, 0);
        ASSERT_NE(fd_client, -1);
        res = connect(fd_client, (struct sockaddr *) &saddr, sizeof(saddr));
        ASSERT_NE(res, -1);
        res = send(fd_client, "hello", strlen("hello")+1, 0);
        ASSERT_NE(res, -1);
        res = recvfrom(fd_client, buf, sizeof(buf), 0, &from_addr, &from_len);
        ASSERT_NE(res, -1);
        EXPECT_EQ(0, (int)from_len);  /* no from addr with SOCK_STREAM */
        ASSERT_STREQ(buf, "goodbye");

        close(fd_client);
        exit(0);
    } else {
        /* wait for child to connect */
        size = sizeof(saddr); 
        fd_connect = accept(fd_socket, (struct sockaddr *) &saddr, &size);
        ASSERT_NE(fd_connect, -1);

        /* exchange greetings */
        res = recv(fd_connect, buf, sizeof(buf), 0);
        ASSERT_NE(res, -1);
        ASSERT_STREQ(buf, "hello");
        res = send(fd_connect, "goodbye", strlen("goodbye")+1, 0);
        ASSERT_NE(res, -1);

        int status;
        do {
            res = waitpid(child, &status, 0);
        } while (res == -1 && errno == EINTR);
        ASSERT_EQ(res, child);
        ASSERT_EQ(0, status);

        close(fd_connect);
        close(fd_socket);
    }
}
开发者ID:rnk,项目名称:drmemory,代码行数:78,代码来源:socket_tests_posix.cpp


示例4: TEST

TEST(stat_test, get_config) {
    stat_client cli(host(), port(), cluster_name(), timeout());
    ASSERT_NE("", cli.get_config());
}
开发者ID:josephwinston,项目名称:jubatus,代码行数:4,代码来源:stat_test.cpp


示例5: locate_file

char *
locate_file (const char *name)
{
  ASSERT_NE (NULL, path_to_selftest_files);
  return concat (path_to_selftest_files, "/", name, NULL);
}
开发者ID:WojciechMigda,项目名称:gcc,代码行数:6,代码来源:selftest.c


示例6: TEST_F

TEST_F(ExoticaTaskTest, XIT) //!< XML Initialisation Test
{
    boost::shared_ptr<tinyxml2::XMLHandle> xml_handle;
    tinyxml2::XMLDocument doc;
    ASSERT_EQ(tinyxml2::XML_NO_ERROR,
              doc.LoadFile((resource_path_ + std::string("ex_task_1.xml")).c_str()));
    xml_handle.reset(new tinyxml2::XMLHandle(*(doc.RootElement())));
    ASSERT_NE(nullptr, xml_handle)<< " : Aborting: could  not initialise";

    params_.optimisation_window = 2;  //!< Test with 2 instances
    task1_p_ = boost::dynamic_pointer_cast<ExoticaTaskTest_1>(
                   exotica::TaskCreator::Instance()->createObject("ExoticaTask_1", params_));
    ASSERT_TRUE(task1_p_ != nullptr)<<" : Could not initialise object";
    EXPECT_EQ(2, task1_p_->getParameters().optimisation_window)
            << " : Incorrect initialisation";
    EXPECT_TRUE(task1_p_->initBase(*xml_handle));
    EXPECT_TRUE(task1_p_->derived_called);
    task1_p_->clearFlags();

    //!< Goal Weights
    EXPECT_EQ(Eigen::MatrixXd::Identity(3, 3), task1_p_->getGoalWeights(0));
    EXPECT_EQ(Eigen::MatrixXd::Ones(3, 3), task1_p_->getGoalWeights(1));
    EXPECT_EQ(Eigen::MatrixXd::Zero(1, 1), task1_p_->getGoalWeights(2));

    //!< Task Weight
    EXPECT_FLOAT_EQ(0.5, task1_p_->getTaskWeight(0));
    EXPECT_FLOAT_EQ(0.2, task1_p_->getTaskWeight(1));
    EXPECT_GT(0, task1_p_->getTaskWeight(2));

    //!< Goal
    Eigen::VectorXd goal_0(3);
    Eigen::VectorXd goal_1(3);
    goal_0 << 0.2, 0.4, 0.6;
    goal_1 << 0.5, 0.5, 0.5;
    ASSERT_EQ(goal_0.size(), task1_p_->getGoal(0).size());
    EXPECT_EQ(goal_0, task1_p_->getGoal(0));
    EXPECT_FLOAT_EQ(0.2, task1_p_->getTolerance()); //!< Should give the zeroth one..
    ASSERT_EQ(goal_1.size(), task1_p_->getGoal(1).size());
    EXPECT_EQ(goal_1, task1_p_->getGoal(1));
    EXPECT_FLOAT_EQ(0.01, task1_p_->getTolerance(1));
    EXPECT_EQ(Eigen::VectorXd::Zero(1), task1_p_->getGoal(2));
    EXPECT_GT(0, task1_p_->getTolerance(2));

    //!< Private members (check that they are passed ok from base) (task of type 2)
    ASSERT_EQ(tinyxml2::XML_NO_ERROR,
              doc.LoadFile(
                  (resource_path_ + std::string("ExoticaTask2_default.xml")).c_str()));
    xml_handle.reset(new tinyxml2::XMLHandle(*(doc.RootElement())));
    ASSERT_NE(nullptr, xml_handle)<< " : Aborting: could  not initialise";

    params_.optimisation_window = 1;  //!< Test with 1 instances
    task2_p_ = boost::dynamic_pointer_cast<ExoticaTaskTest_2>(
                   exotica::TaskCreator::Instance()->createObject("ExoticaTask_2", params_));
    ASSERT_TRUE(task2_p_ != nullptr)<<" : Could not initialise object";
    EXPECT_EQ(1, task2_p_->getParameters().optimisation_window)
            << " : Incorrect initialisation";
    EXPECT_TRUE(task2_p_->initBase(*xml_handle));
    EXPECT_TRUE(task2_p_->derived_called);
    task2_p_->clearFlags();
    EXPECT_EQ(6, task2_p_->int_element);
    EXPECT_EQ(0, task2_p_->string_element.compare("blabla"));
}
开发者ID:bmagyar,项目名称:exotica,代码行数:62,代码来源:TaskDefinitionTest.cpp


示例7: segment_length

 /** 
  * Return the number of rows in the segment.
  * Will throw an exception if the sarray is invalid (there is an error
  * reading files)
  */
 size_t segment_length(size_t segment) const {
   ASSERT_NE(reader, NULL);
   return m_segment_lengths[segment];
 }
开发者ID:Bhushan1002,项目名称:SFrame,代码行数:9,代码来源:sarray_reader.hpp


示例8: get_index_file

 /**
  * Return the file prefix of the sarray (paramter on construction)
  */
 std::string get_index_file() const {
   ASSERT_NE(reader, NULL);
   return reader->get_index_file();
 }
开发者ID:Bhushan1002,项目名称:SFrame,代码行数:7,代码来源:sarray_reader.hpp


示例9: TEST

TEST(SlotMap, ReplaceNodesAlsoSlave)
{
    cerb::SlotMap::select_slave_if_possible();
    cerb::SlotMap slot_map;

    std::set<cerb::Server*> replaced = slot_map.replace_map(cerb::parse_slot_map(
                                           "69853562969c74ff387f9e491d025b2a86ac478f 192.168.1.100:7002 master - 0 0 3 connected 8192-12287\n"
                                           "2f53d0fb4a59274e83e47b1dca02697384822ca5 192.168.1.100:7006 slave 69853562969c74ff387f9e491d025b2a86ac478f 0 0 3 connected\n"
                                           "2560c867f9ca2ef4cc872eb85ce985373ad9e815 192.168.1.101:7003 master - 0 0 2 connected 0-4095\n"
                                           "933970b4fd2d1ad06166ab1d893e8cac7b129ebd 192.168.1.101:7001 master - 0 0 4 connected 4096-8191\n"
                                           "d3adf40539ad749d214609987563bf9903a57ffc 192.168.1.101:7007 slave 2560c867f9ca2ef4cc872eb85ce985373ad9e815 0 0 2 connected\n"
                                           "6c001456aff0ae537ba242d4e86fb325c5babbea 192.168.1.100:7000 myself,master - 0 0 1 connected 12288-16383\n",
                                           "127.0.0.1"), nullptr);

    ASSERT_TRUE(replaced.empty());

    for (cerb::slot s = 0; s < 4096; ++s) {
        cerb::Server* svr = slot_map.get_by_slot(s);
        ASSERT_NE(nullptr, svr) << " slot #" << s;
        ASSERT_EQ("192.168.1.101", svr->addr.host) << " slot #" << s;
        ASSERT_EQ(7007, svr->addr.port) << " slot #" << s;
    }

    for (cerb::slot s = 4096; s < 8192; ++s) {
        cerb::Server* svr = slot_map.get_by_slot(s);
        ASSERT_NE(nullptr, svr) << " slot #" << s;
        ASSERT_EQ("192.168.1.101", svr->addr.host) << " slot #" << s;
        ASSERT_EQ(7001, svr->addr.port) << " slot #" << s;
    }

    for (cerb::slot s = 8192; s < 12288; ++s) {
        cerb::Server* svr = slot_map.get_by_slot(s);
        ASSERT_NE(nullptr, svr) << " slot #" << s;
        ASSERT_EQ("192.168.1.100", svr->addr.host) << " slot #" << s;
        ASSERT_EQ(7006, svr->addr.port) << " slot #" << s;
    }

    for (cerb::slot s = 12288; s < 16384; ++s) {
        cerb::Server* svr = slot_map.get_by_slot(s);
        ASSERT_NE(nullptr, svr) << " slot #" << s;
        ASSERT_EQ("192.168.1.100", svr->addr.host) << " slot #" << s;
        ASSERT_EQ(7000, svr->addr.port) << " slot #" << s;
    }

    std::set<cerb::Server*> to_be_replaced;
    to_be_replaced.insert(slot_map.get_by_slot(0));

    replaced = slot_map.replace_map(cerb::parse_slot_map(
                                        "69853562969c74ff387f9e491d025b2a86ac478f 192.168.1.100:7002 master - 0 0 3 connected 8192-12287\n"
                                        "2f53d0fb4a59274e83e47b1dca02697384822ca5 192.168.1.100:7006 slave 69853562969c74ff387f9e491d025b2a86ac478f 0 0 3 connected\n"
                                        "2560c867f9ca2ef4cc872eb85ce985373ad9e815 192.168.1.101:7003 master - 0 0 2 connected 0-4095\n"
                                        "933970b4fd2d1ad06166ab1d893e8cac7b129ebd 192.168.1.101:7001 master - 0 0 4 connected 4096-8191\n"
                                        "6c001456aff0ae537ba242d4e86fb325c5babbea 192.168.1.100:7000 myself,master - 0 0 1 connected 12288-16383\n",
                                        "127.0.0.1"), nullptr);

    ASSERT_EQ(to_be_replaced, replaced);

    for (cerb::slot s = 0; s < 4096; ++s) {
        cerb::Server* svr = slot_map.get_by_slot(s);
        ASSERT_NE(nullptr, svr) << " slot #" << s;
        ASSERT_EQ("192.168.1.101", svr->addr.host) << " slot #" << s;
        ASSERT_EQ(7003, svr->addr.port) << " slot #" << s;
    }

    for (cerb::slot s = 4096; s < 8192; ++s) {
        cerb::Server* svr = slot_map.get_by_slot(s);
        ASSERT_NE(nullptr, svr) << " slot #" << s;
        ASSERT_EQ("192.168.1.101", svr->addr.host) << " slot #" << s;
        ASSERT_EQ(7001, svr->addr.port) << " slot #" << s;
    }

    for (cerb::slot s = 8192; s < 12288; ++s) {
        cerb::Server* svr = slot_map.get_by_slot(s);
        ASSERT_NE(nullptr, svr) << " slot #" << s;
        ASSERT_EQ("192.168.1.100", svr->addr.host) << " slot #" << s;
        ASSERT_EQ(7006, svr->addr.port) << " slot #" << s;
    }

    for (cerb::slot s = 12288; s < 16384; ++s) {
        cerb::Server* svr = slot_map.get_by_slot(s);
        ASSERT_NE(nullptr, svr) << " slot #" << s;
        ASSERT_EQ("192.168.1.100", svr->addr.host) << " slot #" << s;
        ASSERT_EQ(7000, svr->addr.port) << " slot #" << s;
    }
}
开发者ID:nevermatch,项目名称:redis-cerberus,代码行数:85,代码来源:slot_map.cpp


示例10: num_segments

 /** 
  * Return the number of segments in the collection. 
  * Will throw an exception if the sarray is invalid (there is an error
  * reading files)
  */
 size_t num_segments() const {
   ASSERT_NE(reader, NULL);
   return m_num_segments;
 }
开发者ID:Bhushan1002,项目名称:SFrame,代码行数:9,代码来源:sarray_reader.hpp


示例11: TEST_F

TEST_F(HostTest, IsSingleton) {

	ASSERT_NE(h, NULL);
	ASSERT_NE(*h, NULL);

}
开发者ID:jmriviere,项目名称:pbrt-v2,代码行数:6,代码来源:test_host.cpp


示例12: TEST

TEST(MallocTests, HeapCompact) {
    HANDLE heap = GetProcessHeap();
    ASSERT_NE(heap, (HANDLE)NULL);
    SIZE_T largest = HeapCompact(heap, 0);
    ASSERT_GT(largest, 1024);
}
开发者ID:Maximus5,项目名称:drmemory,代码行数:6,代码来源:malloc_tests_win.cpp


示例13: TEST

// Checks the tests are running against ANGLE
TEST(EGLSanityCheckTest, IsRunningOnANGLE)
{
    const char *extensionString =
        static_cast<const char *>(eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS));
    ASSERT_NE(strstr(extensionString, "EGL_ANGLE_platform_angle"), nullptr);
}
开发者ID:luke-chang,项目名称:gecko-1,代码行数:7,代码来源:EGLSanityCheckTest.cpp


示例14: get_file_names

 /**
  * Returns the collection of files storing the sarray.
  * For instance: [file_prefix].sidx, [file_prefix].0001, etc.
  */
 std::vector<std::string> get_file_names() const {
   ASSERT_NE(reader, NULL);
   return reader->get_index_info().segment_files;
 }
开发者ID:Bhushan1002,项目名称:SFrame,代码行数:8,代码来源:sarray_reader.hpp


示例15: main

int main(int argc, char** argv) {
//   cppipc::comm_client client({"localhost:2181"}, "test");
  cppipc::comm_client client({}, "tcp://127.0.0.1:19000");
  /*
  cppipc::comm_client client({}, 
                             "ipc:///tmp/cppipc_server_test");
                             */
  if (argc >= 2) {
    client.add_auth_method(std::make_shared<cppipc::authentication_token_method>(argv[1]));
  }
  client.start();
  client.add_status_watch(WATCH_COMM_SERVER_INFO, 
                          [](std::string message) {
                          std::cout << message << "\n";
                          });

  for (size_t i = 0;i < 100; ++i) {
  try { 
    test_object_proxy test_object(client);
    std::cout << test_object.ping("hello world") << "\n";

    std::cout << "5 + 1 = " << test_object.add_one(5, "hello") << "\n";
    std::cout << "5 + 5 = " << test_object.add(5, 5) << "\n";
    std::cout << "5 - 5 = " << test_object.subtract(5, 5) << "\n";
    std::cout << "return_one = " << test_object.return_one() << "\n";
    ASSERT_EQ(test_object.add(5, 5), 10);
    ASSERT_EQ(test_object.subtract(5, 5), 0);
  } catch (cppipc::reply_status status) {
    std::cout << "Exception: " << cppipc::reply_status_to_string(status) << "\n";
  } catch (const char* s) {
    std::cout << "Exception: " << s << "\n";
  }
  }

  std::shared_ptr<test_object_proxy> pika(std::make_shared<test_object_proxy>(client));
  std::shared_ptr<test_object_proxy> chu(std::make_shared<test_object_proxy>(client));

  pika->set_value(10);
  chu->set_value(5);
  ASSERT_EQ(pika->get_value(), 10);
  ASSERT_EQ(chu->get_value(), 5);

  pika->subtract_from(std::static_pointer_cast<test_object_base>(chu));
  ASSERT_EQ(pika->get_value(), 5);
  ASSERT_EQ(chu->get_value(), 5);

  chu->subtract_from(std::static_pointer_cast<test_object_base>(pika));
  ASSERT_EQ(pika->get_value(), 5);
  ASSERT_EQ(chu->get_value(), 0);

  pika->swap(std::static_pointer_cast<test_object_base>(chu));
  ASSERT_EQ(pika->get_value(), 0);
  ASSERT_EQ(chu->get_value(), 5);

  chu->swap(std::static_pointer_cast<test_object_base>(pika));
  ASSERT_EQ(pika->get_value(), 5);
  ASSERT_EQ(chu->get_value(), 0);

  chu->set_value(2);
  std::shared_ptr<test_object_proxy> p = std::dynamic_pointer_cast<test_object_proxy>(*pika - chu);
  ASSERT_NE(p.get(), NULL);
  ASSERT_EQ(p->get_value(), 3);

  // Test objects with reference count greater than 1
  std::shared_ptr<test_object_proxy> q = std::dynamic_pointer_cast<test_object_proxy>(*pika + chu);
  ASSERT_EQ(q->get_value(), 7);
  ASSERT_EQ(chu->get_value(), 7);
  ASSERT_EQ(pika->get_value(), 5);

  bool exception_caught = false;
  try {
    chu->an_exception();
  } catch (cppipc::ipcexception& except) {
    std::cout << except.what() << "\n";
    exception_caught = true;
  }

  ASSERT_TRUE(exception_caught);

  // ping test with increasing lengths
  test_object_proxy test_object(client);
  for (size_t i = 0;i <= 25; ++i) {
    size_t j = ((size_t)1 << i) - 1;
    graphlab::timer ti;
    std::cout << "Sending ping of length " << j << std::endl;
    std::string ret = test_object.return_big_object(j);
    std::cout << "Ping of length " << j << " RTT = " << ti.current_time() << "s" << std::endl;
    ASSERT_EQ(ret.length(), j);
  }
  p.reset();
}
开发者ID:Bhushan1002,项目名称:SFrame,代码行数:91,代码来源:client_test.cpp


示例16: end

 /** Return the end iterator of the segment.
  * The iterator (\ref sarray_iterator) is of the input iterator type and 
  * has value_type T. See \ref end() to get the end iterator of the segment.
  *
  * The iterator is invalid once the originating sarray is destroyed.
  * Accessing the iterator after the sarray is destroyed is undefined behavior.
  *
  * \code
  * // example to print segment 1 to screen
  * auto iter = sarr.begin(1);
  * auto enditer =sarr.end(1);
  * while(iter != enditer) {
  *   std::cout << *iter << "\n";
  *   ++iter;
  * }
  * \endcode
  *
  * Will throw an exception if the sarray is invalid (there is an error
  * reading files) Also segmentid must be a valid segment ID. Will throw an
  * exception otherwise.
  */
 iterator end(size_t segmentid) const {
   ASSERT_NE(reader, NULL);
   ASSERT_LT(segmentid, num_segments());
   return iterator(&(m_read_buffers[segmentid]), segmentid, false);
 }
开发者ID:Bhushan1002,项目名称:SFrame,代码行数:26,代码来源:sarray_reader.hpp


示例17: TEST_F

TEST_F(TestObject, multipleConnect)
{
  int additional_timeout = 5;//time to wait after having received the correct number of callbacks
  i = 0;
  qi::SignalLink link1 = oclient2.connect(se2, oserver1, callbackId).value(2000);
  qi::SignalLink link2 = oclient2.connect(se2, oserver1, callbackId).value(2000);
  qi::SignalLink link3 = oclient2.connect(se2, oserver1, callbackId).value(2000);
  qi::SignalLink link4 = oclient2.connect(se2, oserver1, callbackId).value(2000);

  ASSERT_NE(link1, link2);
  ASSERT_NE(link2, link3);
  ASSERT_NE(link3, link4);

  oclient2.post("fire2", 42);
  oclient2.post("fire2", 42);

  int waiting_time = 0;
  while(i._value != 8 && waiting_time < 10000)//waiting 10 seconds max
  {
    qi::os::msleep(additional_timeout); //additional timeout to wait for unwanted callback
    waiting_time += additional_timeout;
  }
  qi::os::msleep(additional_timeout);
  ASSERT_EQ(i._value, 8);

  //disconnect 3/4 callbacks
  oclient2.disconnect(link2);
  oclient2.disconnect(link3);
  oclient2.disconnect(link4);

  oclient2.post("fire2", 42);//post signal twice
  oclient2.post("fire2", 42);

  while(i._value != 10 && waiting_time < 10000)//waiting 10 seconds max
  {
    qi::os::msleep(additional_timeout); //additional timeout to wait for unwanted callback
    waiting_time += additional_timeout;
  }
  qi::os::msleep(additional_timeout); //additional timeout to wait for unwanted callback
  ASSERT_EQ(i._value, 10);
  //i = 0;

  //reconnect callbacks
  link2 = oclient2.connect(se2, oserver1, callbackId).value(2000);
  link3 = oclient2.connect(se2, oserver1, callbackId).value(2000);
  link4 = oclient2.connect(se2, oserver1, callbackId).value(2000);

  oclient2.post("fire2", 42);//post signal twice
  oclient2.post("fire2", 42);

  while((*i) != 18 && waiting_time < 10000)//waiting 10 seconds max
  {
    qi::os::msleep(additional_timeout); //additional timeout to wait for unwanted callback
    waiting_time += additional_timeout;
  }
  qi::os::msleep(additional_timeout); //additional timeout to wait for unwanted callback
  ASSERT_EQ(*i, 18);

  oclient2.disconnect(link1);
  oclient2.disconnect(link2);
  oclient2.disconnect(link3);
  oclient2.disconnect(link4);

  oclient2.post("fire2", 42);

  qi::os::msleep(additional_timeout); //additional timeout to wait for unwanted callback
  ASSERT_EQ(*i, 18);

}
开发者ID:dmerejkowsky,项目名称:libqi,代码行数:69,代码来源:test_event_remote_connect.cpp


示例18: TEST

TEST(ConstantPropagationTest1, constantpropagation) {
  g_redex = new RedexContext();

	const char* dexfile =
    "gen/native/redex/test/integ/constant-propagation-test-dex/constant-propagation.dex";
  if (access(dexfile, R_OK) != 0) {
    dexfile = std::getenv("dexfile");
    ASSERT_NE(nullptr, dexfile);
  }

  std::vector<DexClasses> dexen;
  dexen.emplace_back(load_classes_from_dex(dexfile));
  DexClasses& classes = dexen.back();
  std::cout << "Loaded classes: " << classes.size() << std::endl;

	TRACE(CONSTP, 2, "Code before:\n");
  for(const auto& cls : classes) {
    TRACE(CONSTP, 2, "Class %s\n", SHOW(cls));
    if (filter_test_classes(cls->get_name()) < 2) {
      TRACE(CONSTP, 2, "Class %s\n", SHOW(cls));
      for (const auto& dm : cls->get_dmethods()) {
        TRACE(CONSTP, 2, "dmethod: %s\n",  dm->get_name()->c_str());
        if (strcmp(dm->get_name()->c_str(), "propagation_1") == 0 ||
            strcmp(dm->get_name()->c_str(), "propagation_2") == 0 ||
            strcmp(dm->get_name()->c_str(), "propagation_3") == 0) {
          TRACE(CONSTP, 2, "dmethod: %s\n",  SHOW(dm->get_code()));
        }
      }
    }
  }

  std::vector<Pass*> passes = {
    new ConstantPropagationPass(),
    new LocalDcePass()
  };

  std::vector<KeepRule> null_rules;
  PassManager manager(passes, null_rules);

  Json::Value conf_obj = Json::nullValue;
  ConfigFiles dummy_cfg(conf_obj);
  dummy_cfg.using_seeds = true;
  manager.run_passes(dexen, dummy_cfg);

  TRACE(CONSTP, 2, "Code after:\n");
  for(const auto& cls : classes) {
    TRACE(CONSTP, 2, "Class %s\n", SHOW(cls));
    //ASSERT_NE(filter_test_classes(cls->get_name()), REMOVEDCLASS);
    if (filter_test_classes(cls->get_name()) == MAINCLASS) {
      for (const auto& dm : cls->get_dmethods()) {
        TRACE(CONSTP, 2, "dmethod: %s\n",  dm->get_name()->c_str());
        if (strcmp(dm->get_name()->c_str(), "propagation_1") == 0) {
          TRACE(CONSTP, 2, "dmethod: %s\n",  SHOW(dm->get_code()));
          for (auto const instruction : dm->get_code()->get_instructions()) {
            ASSERT_NE(instruction->opcode(), OPCODE_IF_EQZ);
            ASSERT_NE(instruction->opcode(), OPCODE_NEW_INSTANCE);
          }
        } else if (strcmp(dm->get_name()->c_str(), "propagation_2") == 0) {
          TRACE(CONSTP, 2, "dmethod: %s\n",  SHOW(dm->get_code()));
          for (auto const instruction : dm->get_code()->get_instructions()) {
            ASSERT_NE(instruction->opcode(), OPCODE_IF_EQZ);
            ASSERT_NE(instruction->opcode(), OPCODE_INVOKE_STATIC);
          }
        } else if(strcmp(dm->get_name()->c_str(), "propagation_3") == 0) {
          TRACE(CONSTP, 2, "dmethod: %s\n",  SHOW(dm->get_code()));
          for (auto const instruction : dm->get_code()->get_instructions()) {
            //ASSERT_NE(instruction->opcode(), OPCODE_IF_EQZ);
            //ASSERT_NE(instruction->opcode(), OPCODE_INVOKE_STATIC);
          }
        }
      }
    }
  }
}
开发者ID:zhourihu5,项目名称:redex,代码行数:74,代码来源:ConstantPropagationTest.cpp


示例19: TEST

TEST(uri_comparison_test, equality_test_capitalized_scheme) {
  network::uri lhs("http://www.example.com/");
  network::uri rhs("HTTP://www.example.com/");
  ASSERT_NE(lhs.compare(rhs, network::uri_comparison_level::string_comparison), 0);
}
开发者ID:chrismanning,项目名称:uri,代码行数:5,代码来源:uri_comparison_test.cpp


示例20: make_temp_file

named_temp_file::named_temp_file (const char *suffix)
{
  m_filename = make_temp_file (suffix);
  ASSERT_NE (m_filename, NULL);
}
开发者ID:WojciechMigda,项目名称:gcc,代码行数:5,代码来源:selftest.c



注:本文中的ASSERT_NE函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ ASSERT_NEAR函数代码示例发布时间:2022-05-30
下一篇:
C++ ASSERT_ND函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap