当前位置: 首页>>代码示例>>C++>>正文


C++ TASSERT函数代码示例

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


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

示例1: string

bool Configmgr::LoadModuleConfig() {
    TiXmlDocument doc;
    string coreConfigPath = string(tools::GetAppPath()) + "/config/module.xml";
    if (!doc.LoadFile(coreConfigPath.c_str())) {
        TASSERT(false, "can't find module file : %s", coreConfigPath.c_str());
        return false;
    }

    const TiXmlElement * pRoot = doc.RootElement();
    TASSERT(pRoot, "module.xml format error");
    const char * pPath = pRoot->Attribute("path");
    TASSERT(pPath, "module.xml format error, can't find module path");
    m_oModuleConfig.strModulePath = pPath;
    
    const TiXmlElement * pModule = pRoot->FirstChildElement("module");
    while (pModule) {
        const char * pName = pModule->Attribute("name");
        TASSERT(pName, "module.xml form error, can't find module's name");
        
        m_oModuleConfig.vctModules.push_back(pName);
        
        pModule = pModule->NextSiblingElement("module");
    }
    
    return true;
}
开发者ID:RicMei,项目名称:kernel4gameserver,代码行数:26,代码来源:Configmgr.cpp

示例2: _test_add_paths

void _test_add_paths(dBGraph *graph,
                     AsyncIOData *iodata, CorrectAlnInput *task,
                     GenPathWorker *wrkrs, char *seq,
                     size_t exp_npaths, size_t exp_nkmers, size_t exp_pbytes)
{
  size_t npaths = graph->pstore.num_of_paths;
  size_t nkmers = graph->pstore.num_kmers_with_paths;
  uint8_t *next = graph->pstore.next;

  // Set up asyncio input data
  seq_read_set(&iodata->r1, seq);
  seq_read_reset(&iodata->r2);
  iodata->fq_offset1 = iodata->fq_offset2 = 0;
  iodata->ptr = NULL;
  // Add paths
  gen_paths_worker_seq(wrkrs, iodata, task);

  // Check we added the right number of paths
  TASSERT(graph->pstore.num_of_paths == npaths + exp_npaths);
  TASSERT(graph->pstore.num_kmers_with_paths == nkmers + exp_nkmers);

  // Check memory used
  size_t path_mem = sizeof(PathIndex) + graph->pstore.colset_bytes +
                    sizeof(PathLen) + graph->pstore.extra_bytes;
  size_t exp_mem = path_mem * exp_npaths + exp_pbytes;
  TASSERT(graph->pstore.next == next + exp_mem);
}
开发者ID:jeromekelleher,项目名称:mccortex,代码行数:27,代码来源:all_tests.c

示例3: test_klist_append

void test_klist_append () {
    TASSERT(l1 != NULL);
    klist_append(l1, (void *)item2);
    klist_append(l1, (void *)item3);
    klist_prepend(l1, (void *)item1);
    TASSERT(l1->length == 3);
}
开发者ID:fdgonthier,项目名称:libktools,代码行数:7,代码来源:klist.c

示例4: _call_bubble

// `nbuf` and `sbuf` are temporary variables used by this function
static void _call_bubble(BubbleCaller *caller,
                         const char *flank5p, const char *flank3p,
                         const char **alleles, size_t num_alleles,
                         dBNodeBuffer *nbuf, StrBuf *sbuf)
{
  const dBGraph *graph = caller->db_graph;
  const size_t kmer_size = graph->kmer_size;

  dBNode node5p = db_graph_find_str(graph, flank5p+strlen(flank5p)-kmer_size);
  dBNode node3p = db_graph_find_str(graph, flank3p);
  TASSERT(node5p.key != HASH_NOT_FOUND);
  TASSERT(node3p.key != HASH_NOT_FOUND);

  Edges edges5p = db_node_get_edges_union(graph, node5p.key);
  Edges edges3p = db_node_get_edges_union(graph, node3p.key);
  TASSERT(edges_get_outdegree(edges5p, node5p.orient) > 1);
  TASSERT(edges_get_indegree(edges3p, node3p.orient) > 1);

  find_bubbles(caller, node5p);

  GCacheUnitig *snode3p;
  Orientation snorient3p;
  GCacheStepPtrBuf *stepbuf;

  // Get 3p flank and orientation
  snode3p = graph_cache_find_unitig(&caller->cache, node3p);
  TASSERT(snode3p != NULL);
  snorient3p = gc_unitig_get_orient(&caller->cache, snode3p, node3p);

  find_bubbles_ending_with(caller, snode3p);

  stepbuf = (snorient3p == FORWARD ? &caller->spp_forward : &caller->spp_reverse);

  _check_alleles(&caller->cache, stepbuf, alleles, num_alleles, nbuf, sbuf);
}
开发者ID:Phelimb,项目名称:mccortex,代码行数:36,代码来源:bubble_caller_tests.c

示例5: test_binary_seq_rev_cmp

static void test_binary_seq_rev_cmp()
{
  test_status("binary_seq_reverse_complement() binary_seq_to_str()");

  uint8_t data[TLEN], tmp[TLEN];
  char str[4*TLEN+1], rev[4*TLEN+1], restore[4*TLEN+1];
  size_t i, j, k, nbases;

  for(i = 0; i < NTESTS; i++)
  {
    // Get random sequence, mask top byte, convert to string
    rand_bytes(data, TLEN);
    nbases = rand() & (4*TLEN-1);
    binary_seq_to_str(data, nbases, str);

    // Reverse complement, convert to string
    memcpy(tmp, data, TLEN);
    binary_seq_reverse_complement(tmp, nbases);
    binary_seq_to_str(tmp, nbases, rev);

    // Check strings match
    for(j = 0, k = nbases-1; j < nbases; j++, k--)
      TASSERT(str[j] == dna_char_complement(rev[k]));

    // Reverse complement again, check we get back same binary_seq+string
    binary_seq_reverse_complement(tmp, nbases);
    binary_seq_to_str(tmp, nbases, restore);
    TASSERT(memcmp(data, tmp, TLEN) == 0);
    TASSERT(strncmp(str, restore, nbases) == 0);
  }
}
开发者ID:jeromekelleher,项目名称:mccortex,代码行数:31,代码来源:binary_seq_tests.c

示例6: while

void resource_pool_t::waiter_wake()
{
    while ( !static_list_is_empty(&_waiters) ) {
        int num_unreserved = _capacity - _reserved;
    
        void* waiter_node;
        int get_ret =
            static_list_get_head(&_waiters, &waiter_node);
        TASSERT(get_ret == 0);
        struct waiter_node_s* wn = (struct waiter_node_s*)waiter_node;
    
        if (num_unreserved < wn->req_reserve_count)
            /* Not enough resources to let this thread through... */
            return;
    
        /* Hit another thread that can be allowed to pass. */
        /* Remove thread from queue. Wake it. Update rpaphore count. */
        int remove_ret =
            static_list_remove_head(&_waiters, &waiter_node, NULL);
        TASSERT(remove_ret == 0);
        wn = (struct waiter_node_s*)waiter_node;
 
        _reserved += wn->req_reserve_count;
        pthread_cond_signal(&wn->request_granted);
    }
}
开发者ID:glycerine,项目名称:shore-mt,代码行数:26,代码来源:resource_pool.cpp

示例7: vTraceCtor

void vTraceCtor(APG_PARSER_CTX* spParserCtx){
	if(!spParserCtx->vpTraceCtx){
		apg_uint uiSize;
		APG_TRACE_CTX* spCtx = (APG_TRACE_CTX*)vpMemAlloc(spParserCtx->vpMemCtx, sizeof(APG_TRACE_CTX));
		TASSERT(spCtx);
		memset((void*)spCtx, 0, sizeof(APG_TRACE_CTX));
		spOut = stdout;
		spCtx->spParserCtx = spParserCtx;
		spCtx->uiRecordNumber = 0;
		spCtx->uiTreeDepth = 0;
		spCtx->uiTraceRootIndex = spParserCtx->uiRuleCount;
		spCtx->vpVecRecordStack = vpVecCtor(spParserCtx->vpMemCtx, sizeof(apg_uint), 1028);
		TASSERT(spCtx->vpVecRecordStack);
		uiSize = sizeof(apg_uint) * spParserCtx->uiRuleCount;
		spCtx->uipRules = (apg_uint*)vpMemAlloc(spParserCtx->vpMemCtx, uiSize);
		TASSERT(spCtx->uipRules);
		if(spParserCtx->uiUdtCount){
			uiSize = sizeof(apg_uint) * spParserCtx->uiUdtCount;
			spCtx->uipUdts = (apg_uint*)vpMemAlloc(spParserCtx->vpMemCtx, uiSize);
			TASSERT(spCtx->uipUdts);
		}
		vEnableDefault(spCtx);
		spParserCtx->vpTraceCtx = (void*)spCtx;
	}
}
开发者ID:ldthomas,项目名称:apg-6.3,代码行数:25,代码来源:Trace.c

示例8: test_klist_index

void test_klist_index () {
    char * item_ptr;
    klist_get(l1, 0, (void **) &item_ptr);	
    TASSERT(item_ptr == item1);
    klist_get(l1, 2, (void **) &item_ptr);
    TASSERT(item_ptr == item3);
}
开发者ID:fdgonthier,项目名称:libktools,代码行数:7,代码来源:klist.c

示例9: test_util_calc_N50

static void test_util_calc_N50()
{
  test_status("Testing calc_N50()");
  size_t arr[] = {1,2,3,4,5,6,7,8,9,10};
  TASSERT(calc_N50(arr, 3, 6) == 3);
  TASSERT(calc_N50(arr, 4, 10) == 3);
  TASSERT(calc_N50(arr, 10, 55) == 8);
}
开发者ID:ambarrio,项目名称:mccortex,代码行数:8,代码来源:util_tests.c

示例10: test_util_rev_nibble_lookup

static void test_util_rev_nibble_lookup()
{
  test_status("Testing rev_nibble_lookup()");
  size_t i;
  for(i = 0; i < 16; i++) {
    TASSERT(rev_nibble_lookup(i) == rev_nibble(i));
    TASSERT(rev_nibble_lookup(rev_nibble_lookup(i)) == i);
  }
}
开发者ID:ambarrio,项目名称:mccortex,代码行数:9,代码来源:util_tests.c

示例11: _check_node_paths

static void _check_node_paths(const char *kmer,
                              const char **path_strs, size_t npaths,
                              size_t colour, const dBGraph *graph)
{
  TASSERT(strlen(kmer) == graph->kmer_size);

  const GPath *paths[npaths]; // corresponding to path_strs
  memset(paths, 0, sizeof(paths));
  size_t i, num_paths_seen = 0;

  const GPathStore *gpstore = &graph->gpstore;
  dBNode node = db_graph_find_str(graph, kmer);

  const GPath *path = gpath_store_fetch_traverse(gpstore, node.key);
  dBNodeBuffer nbuf;
  SizeBuffer jposbuf;
  db_node_buf_alloc(&nbuf, 64);
  size_buf_alloc(&jposbuf, 64);

  #define MAX_SEQ 128
  char seq[MAX_SEQ];

  for(; path != NULL; path = path->next)
  {
    if(path->orient == node.orient &&
       gpath_has_colour(path, gpstore->gpset.ncols, colour))
    {
      TASSERT(num_paths_seen < npaths);
      db_node_buf_reset(&nbuf);
      gpath_fetch(node, path, &nbuf, &jposbuf, colour, graph);
      if(nbuf.len > MAX_SEQ) die("Too many nodes. Cannot continue. %zu", nbuf.len);
      db_nodes_to_str(nbuf.b, nbuf.len, graph, seq);
      TASSERT(strlen(seq) == graph->kmer_size + nbuf.len - 1);
      for(i = 0; i < npaths; i++) {
        if(strcmp(path_strs[i],seq) == 0) {
          TASSERT(paths[i] == NULL, "Duplicate paths: %s", seq);
          paths[i] = path;
          break;
        }
      }
      TASSERT2(i < npaths, "Path not found: %s", seq);
      num_paths_seen++;
    }
  }

  TASSERT(num_paths_seen == npaths);

  for(i = 0; i < npaths; i++) {
    TASSERT2(paths[i] != NULL, "path not in graph: %s", path_strs[i]);
  }

  db_node_buf_dealloc(&nbuf);
  size_buf_dealloc(&jposbuf);
}
开发者ID:ambarrio,项目名称:mccortex,代码行数:54,代码来源:path_tests.c

示例12: handshake

static bool handshake(int fd) {
  TASSERT(write(fd, HANDSHAKE_COMMAND, sizeof(HANDSHAKE_COMMAND)) == sizeof(HANDSHAKE_COMMAND), "Unable to send HFP handshake.");

  char response[256] = { 0 };
  size_t total = 0;
  while (!strstr(response, HANDSHAKE_RESPONSE) && total < sizeof(response)) {
    ssize_t len = read(fd, response + total, sizeof(response) - total);
    TASSERT(len != -1 && len != 0, "Unable to read complete response from socket.");
    total += len;
  }
  TASSERT(strstr(response, HANDSHAKE_RESPONSE) != NULL, "No valid response from HFP audio gateway.");
  return true;
}
开发者ID:Emill,项目名称:android_bluetooth,代码行数:13,代码来源:rfcomm.c

示例13: _test_path_store

void _test_path_store(const dBGraph *graph)
{
  size_t col;
  GraphPathPairing gp;
  gp_alloc(&gp, graph->num_of_cols);

  for(col = 0; col < graph->num_of_cols; col++)
    gp.ctxcols[col] = gp.ctpcols[col] = col;

  // Check data store
  TASSERT(path_store_integrity_check(&graph->pstore));
  TASSERT(graph_paths_check_all_paths(&gp, graph));

  gp_dealloc(&gp);
}
开发者ID:jeromekelleher,项目名称:mccortex,代码行数:15,代码来源:all_tests.c

示例14: _manual_test_pack_cpy_unpack

static void _manual_test_pack_cpy_unpack(const char *seq, size_t len, size_t shift)
{
  TASSERT(len >= shift);
  size_t i, nbytes = (len+3)/4, outlen = len - shift;
  Nucleotide bases[len], bases2[len];
  uint8_t packed[nbytes], packed2[nbytes];
  char seq2[len+1];

  // convert to bases
  for(i = 0; i < len; i++) bases[i] = dna_char_to_nuc(seq[i]);

  // bases -> packed
  binary_seq_pack(packed, bases, len);

  // shift cpy
  binary_seq_cpy(packed2, packed, shift, len);

  // packed -> bases
  binary_seq_unpack(packed2, bases2, outlen);

  // convert to char
  for(i = 0; i < outlen; i++) seq2[i] = dna_nuc_to_char(bases2[i]);
  seq2[outlen] = '\0';

  TASSERT2(strncmp(seq+shift, seq2, outlen) == 0, "in: %s\nout:%s\n", seq, seq2);
}
开发者ID:jeromekelleher,项目名称:mccortex,代码行数:26,代码来源:binary_seq_tests.c

示例15: SystemArch

// Add a function that can be used to transition from native code into lifted
// code.
// isCallback defaults to false
llvm::Function *ArchAddEntryPointDriver(llvm::Module *M,
                                        const std::string &name, VA entry,
                                        bool isCallback) {
  //convert the VA into a string name of a function, try and look it up
  std::stringstream ss;
  ss << "sub_" << std::hex << entry;

  auto s = ss.str();
  llvm::Function *F = M->getFunction(s);
  if (!F) {
    llvm::errs() << "Could not find lifted function " << s
                 << " for entry point " << name;
    return nullptr;
  }

  auto &C = F->getContext();
  auto W = M->getFunction(name);
  if (W) {
    return W;
  }

  auto VoidTy = llvm::Type::getVoidTy(C);
  auto WTy = llvm::FunctionType::get(VoidTy, false);
  W = llvm::Function::Create(
      WTy, llvm::GlobalValue::ExternalLinkage, name, M);

  W->addFnAttr(llvm::Attribute::NoInline);
  W->addFnAttr(llvm::Attribute::Naked);

  const auto Arch = SystemArch(M);
  const auto OS = SystemOS(M);

  if (llvm::Triple::Linux == OS) {
    if (_X86_64_ == Arch) {
      LinuxAddPushJumpStub(M, F, W, "__mcsema_attach_call");
    } else {
      LinuxAddPushJumpStub(M, F, W, "__mcsema_attach_call_cdecl");
    }
  } else if (llvm::Triple::Win32 == OS) {
    // if we are creating and entry point for a callback
    // then we need to decorate the function. 

    // if we are creating an entry point specified via -entrypoint
    // then the name is pre-decorated, and we don't decorate twice
    if (_X86_64_ == Arch) {
      WindowsAddPushJumpStub(isCallback, M, F, W, "__mcsema_attach_call");
    } else {
      WindowsAddPushJumpStub(isCallback, M, F, W, "__mcsema_attach_call_cdecl");
    }
  } else {
    TASSERT(false, "Unsupported OS for entry point driver.");
  }

  F->setLinkage(llvm::GlobalValue::ExternalLinkage);
  if (F->doesNotReturn()) {
    W->setDoesNotReturn();
  }

  return W;
}
开发者ID:kumarak,项目名称:mcsema,代码行数:63,代码来源:Arch.cpp


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