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

C++ FAIL函数代码示例

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

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



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

示例1: TEST

TEST(QueryPlannerTest, threeVarTriples) {
  try {
    ParsedQuery pq = SparqlParser::parse(
        "SELECT ?x ?p ?o WHERE {"
        "<s> <p> ?x . ?x ?p ?o }");
    QueryPlanner qp(nullptr);
    QueryExecutionTree qet = qp.createExecutionTree(pq);
    ASSERT_EQ(
        "{\n  JOIN\n  {\n    SCAN FOR FULL INDEX SPO (DUMMY OPERATION)\n   "
        " qet-width: 3 \n  } join-column: [0]\n  |X|\n  {\n    SCAN"
        " PSO with P = \"<p>\", S = \"<s>\"\n    qet-width: 1 \n  }"
        " join-column: [0]\n  qet-width: 3 \n}",
        qet.asString());
  } catch (const ad_semsearch::Exception& e) {
    std::cout << "Caught: " << e.getFullErrorMessage() << std::endl;
    FAIL() << e.getFullErrorMessage();
  } catch (const std::exception& e) {
    std::cout << "Caught: " << e.what() << std::endl;
    FAIL() << e.what();
  }

  try {
    ParsedQuery pq = SparqlParser::parse(
        "SELECT ?x ?p ?o WHERE {"
        "<s> ?x <o> . ?x ?p ?o }");
    QueryPlanner qp(nullptr);
    QueryExecutionTree qet = qp.createExecutionTree(pq);
    ASSERT_EQ(
        "{\n  JOIN\n  {\n    SCAN FOR FULL INDEX SPO (DUMMY OP"
        "ERATION)\n    qet-width: 3 \n  } join-column: [0]"
        "\n  |X|\n  {\n    SCAN SOP with S = \"<s>\", O = \"<o>\"\n "
        "   qet-width: 1 \n  } join-column: [0]\n  qet-width: 3 \n}",
        qet.asString());
  } catch (const ad_semsearch::Exception& e) {
    std::cout << "Caught: " << e.getFullErrorMessage() << std::endl;
    FAIL() << e.getFullErrorMessage();
  } catch (const std::exception& e) {
    std::cout << "Caught: " << e.what() << std::endl;
    FAIL() << e.what();
  }

  try {
    ParsedQuery pq = SparqlParser::parse(
        "SELECT ?s ?p ?o WHERE {"
        "<s> <p> ?p . ?s ?p ?o }");
    QueryPlanner qp(nullptr);
    QueryExecutionTree qet = qp.createExecutionTree(pq);
    ASSERT_EQ(
        "{\n  JOIN\n  {\n    SCAN FOR FULL INDEX PSO (DUMMY OPERATION)\n"
        "    qet-width: 3 \n  } join-column: [0]\n  |X|\n  {\n "
        "   SCAN PSO with P = \"<p>\", S = \"<s>\"\n  "
        "  qet-width: 1 \n  } join-column: [0]\n  qet-width: 3 \n}",
        qet.asString());
  } catch (const ad_semsearch::Exception& e) {
    std::cout << "Caught: " << e.getFullErrorMessage() << std::endl;
    FAIL() << e.getFullErrorMessage();
  } catch (const std::exception& e) {
    std::cout << "Caught: " << e.what() << std::endl;
    FAIL() << e.what();
  }
}
开发者ID:Buchhold,项目名称:SparqlEngineDraft,代码行数:61,代码来源:QueryPlannerTest.cpp


示例2: typeToBGRA

template<bool avx> void typeToBGRA(const void* const src, void* const dest, const PixelTypes::PixelType type, const size_t size)
{
  const __m_auto_i* const pSrc = reinterpret_cast<const __m_auto_i*>(src);
  const __m_auto_i* const srcEnd = reinterpret_cast<const __m_auto_i*>(src) + (size * PixelTypes::pixelSize(type)) / sizeof(__m_auto_i);
  __m_auto_i* pDest = reinterpret_cast<__m_auto_i*>(dest);

  switch(type)
  {
    case PixelTypes::PixelType::RGB:
      rgbToBGRA<avx>(pSrc, srcEnd, pDest);
      break;
    case PixelTypes::PixelType::YUV:
      yuvToBGRA<avx>(pSrc, srcEnd, pDest);
      break;
    case PixelTypes::PixelType::YUYV:
      yuyvToBGRA<avx>(pSrc, srcEnd, pDest);
      break;
    case PixelTypes::PixelType::Colored:
      coloredToBGRA<avx>(pSrc, srcEnd, pDest);
      break;
    case PixelTypes::PixelType::Grayscale:
      grayscaledToBGRA<avx>(pSrc, srcEnd, pDest);
      break;
    case PixelTypes::PixelType::Hue:
      hueToBGRA(reinterpret_cast<const PixelTypes::HuePixel*>(src), reinterpret_cast<const PixelTypes::HuePixel*>(srcEnd), reinterpret_cast<PixelTypes::BGRAPixel*>(dest));
      break;
    case PixelTypes::PixelType::Edge2:
      edge2ToBGRA<avx>(pSrc, srcEnd, pDest, reinterpret_cast<const __m_auto_i*>(dest) + (size * PixelTypes::pixelSize(PixelTypes::BGRA)) / sizeof(__m_auto_i));
      break;/*
    case PixelTypes::PixelType::Edge2MonoAvg:
      //edge2MonoAvgToBGRA<avx>(pSrc, srcEnd, pDest);
      break;
    case PixelTypes::PixelType::Edge2MonoAbsAvg:
      //edge2MonoAbsAvgBGRA<avx>(pSrc, srcEnd, pDest);
      break;*/
    case PixelTypes::PixelType::Binary:
      binaryToBGRA<avx>(pSrc, srcEnd, pDest);
      break;
    default:
      FAIL("Unknown pixel type.");
  }

  size_t rest = (size * PixelTypes::pixelSize(type)) % sizeof(__m_auto_i);
  if(rest != 0)
  {
    PixelTypes::BGRAPixel* const ppDest = reinterpret_cast<PixelTypes::BGRAPixel*>(dest) + size - rest;
    switch(type)
    {
      case PixelTypes::PixelType::RGB:
        rgbToBGRA(reinterpret_cast<const PixelTypes::RGBPixel*>(src) + size - rest, reinterpret_cast<const PixelTypes::RGBPixel*>(src) + size, ppDest);
        break;
      case PixelTypes::PixelType::YUV:
        yuvToBGRA(reinterpret_cast<const PixelTypes::YUVPixel*>(src) + size - rest, reinterpret_cast<const PixelTypes::YUVPixel*>(src) + size, ppDest);
        break;
      case PixelTypes::PixelType::YUYV:
        yuyvToBGRA(reinterpret_cast<const PixelTypes::YUYVPixel*>(src) + size - rest, reinterpret_cast<const PixelTypes::YUYVPixel*>(src) + size, ppDest);
        break;
      case PixelTypes::PixelType::Colored:
        coloredToBGRA(reinterpret_cast<const PixelTypes::ColoredPixel*>(src) + size - rest, reinterpret_cast<const PixelTypes::ColoredPixel*>(src) + size, ppDest);
        break;
      case PixelTypes::PixelType::Grayscale:
        grayscaledToBGRA(reinterpret_cast<const PixelTypes::GrayscaledPixel*>(src) + size - rest, reinterpret_cast<const PixelTypes::GrayscaledPixel*>(src) + size, ppDest);
        break;
      case PixelTypes::PixelType::Hue:
        hueToBGRA(reinterpret_cast<const PixelTypes::HuePixel*>(src) + size - rest, reinterpret_cast<const PixelTypes::HuePixel*>(src) + size, ppDest);
        break;
      case PixelTypes::PixelType::Edge2:
        edge2ToBGRA(reinterpret_cast<const PixelTypes::Edge2Pixel*>(src) + size - rest, reinterpret_cast<const PixelTypes::Edge2Pixel*>(src) + size, ppDest, reinterpret_cast<PixelTypes::BGRAPixel*>(dest) + size);
        break;
      case PixelTypes::PixelType::Binary:
        binaryToBGRA(reinterpret_cast<const PixelTypes::BinaryPixel*>(src) + size - rest, reinterpret_cast<const PixelTypes::BinaryPixel*>(src) + size, ppDest);
        break;
      default:
        FAIL("Unknown pixel type.");
    }
  }
}
开发者ID:weilandetian,项目名称:Yoyo,代码行数:77,代码来源:DebugImages.cpp


示例3: check

 void check( const BSONObj &one, const BSONObj &two ) {
     if ( one.woCompare( two ) != 0 ) {
         static string fail = string( "Assertion failure expected " ) + string( one ) + ", got " + string( two );
         FAIL( fail.c_str() );
     }
 }
开发者ID:blythedunham,项目名称:mongo,代码行数:6,代码来源:jstests.cpp


示例4: SREcomp

/*
 - SREcomp - compile a regular expression into internal code
 *
 * We can't allocate space until we know how big the compiled form will be,
 * but we can't compile it (and thus know how big it is) until we've got a
 * place to put the code.  So we cheat:  we compile it twice, once with code
 * generation turned off and size counting turned on, and once "for real".
 * This also means that we don't allocate space until we are sure that the
 * thing really will compile successfully, and we never have to move the
 * code and thus invalidate pointers into it.  (Note that it has to be in
 * one piece because free() must be able to free it all.)
 *
 * Beware that the optimization-preparation code in here knows about some
 * of the structure of the compiled SRE.
 */
SRE *
SREcomp(char *exp)
{
	register SRE *r;
	register char *scan;
	register char *longest;
	register int len;
	int flags;

	if (exp == NULL) {
		FAIL("NULL argument");
	}

	/* First pass: determine size, legality. */
	regparse = exp;
	regnpar = 1;
	regsize = 0L;
	regcode = &regdummy;
	regc(SRE_MAGIC);
	if (reg(0, &flags) == NULL) {
		return(NULL);
	}

	/* Small enough for pointer-storage convention? */
	if (regsize >= 32767L) {	/* Probably could be 65535L. */
		FAIL("SRE too big");
	}

	/* Allocate space. */
	r = xalloc(sizeof(SRE) + (unsigned)regsize, 0, 0);
	if (r == NULL) {
		FAIL("out of space");
	}

	/* Second pass: emit code. */
	regparse = exp;
	regnpar = 1;
	regcode = r->program;
	regc(SRE_MAGIC);
	if (reg(0, &flags) == NULL) {
		return(NULL);
	}

	/* Dig out information for optimizations. */
	r->regstart = '\0';	/* Worst-case defaults. */
	r->reganch = 0;
	r->regmust = NULL;
	r->regmlen = 0;
	r->regsize = sizeof(SRE) + regsize;
	scan = r->program+1;			/* First BRANCH. */
	if (OP(regnext(scan)) == END) {		/* Only one top-level choice. */
		scan = OPERAND(scan);

		/* Starting-point info. */
		if (OP(scan) == EXACTLY) {
			r->regstart = *OPERAND(scan);
		} else if (OP(scan) == BEGWORD && OP(regnext(scan)) == EXACTLY) {
			r->regstart = *OPERAND(regnext(scan));
		} else if (OP(scan) == BOL) {
			r->reganch++;
		}

		/*
		 * If there's something expensive in the r.e., find the
		 * longest literal string that must appear and make it the
		 * regmust.  Resolve ties in favor of later strings, since
		 * the regstart check works with the beginning of the r.e.
		 * and avoiding duplication strengthens checking.  Not a
		 * strong reason, but sufficient in the absence of others.
		 */
		if (flags&SPSTART) {
			longest = NULL;
			len = 0;
			for (; scan != NULL; scan = regnext(scan)) {
				if (OP(scan) == EXACTLY && strlen(OPERAND(scan)) >= len) {
					longest = OPERAND(scan);
					len = strlen(OPERAND(scan));
				}
			}
			r->regmust = longest;
			r->regmlen = len;
		}
	}

	return(r);
//.........这里部分代码省略.........
开发者ID:jonathangray,项目名称:freebsd-1.x-ports,代码行数:101,代码来源:sre.c


示例5: regpiece

/*
 - regpiece - something followed by possible [*+?{]
 *
 * Note that the branching code sequences used for ? and the general cases
 * of * and + are somewhat optimized:  they use the same NOTHING node as
 * both the endmarker for their branch list and the body of the last branch.
 * It might seem that this node could be dispensed with entirely, but the
 * endmarker role is not redundant.
 */
static char *
regpiece(int *flagp)
{
	register char	*next;
	register char	*ret;
	register char	op;
	unsigned char	max;
	unsigned char	min;
	int		flags;

	ret = regatom(&flags);
	if (ret == NULL) {
		return(NULL);
	}

	op = *regparse;
	if (!ISMULT(op)) {
		*flagp = flags;
		return(ret);
	}

	if (!(flags&HASWIDTH) && op != '?') {
		FAIL("*+{ operand could be empty");
	}
	*flagp = (op != '+' && op != '{') ? (WORST|SPSTART) : (WORST|HASWIDTH);

	if (op == '*' && (flags&SIMPLE)) {
		reginsert(STAR, ret);
	} else if (op == '*') {
		/* Emit x* as (x&|), where & means "self". */
		reginsert(BRANCH, ret);			/* Either x */
		regoptail(ret, regnode(BACK));		/* and loop */
		regoptail(ret, ret);			/* back */
		regtail(ret, regnode(BRANCH));		/* or */
		regtail(ret, regnode(NOTHING));		/* null. */
	} else if (op == '+' && (flags&SIMPLE)) {
		reginsert(PLUS, ret);
	} else if (op == '+') {
		/* Emit x+ as x(&|), where & means "self". */
		next = regnode(BRANCH);			/* Either */
		regtail(ret, next);
		regtail(regnode(BACK), ret);		/* loop back */
		regtail(next, regnode(BRANCH));		/* or */
		regtail(ret, regnode(NOTHING));		/* null. */
	} else if (op == '{') {
		for (min = 0, regparse++ ; *regparse && isdigit(*regparse) ; regparse++) {
			min = min * 10 + (*regparse - '0');
		}
		for (max = 0, regparse++ ; *regparse && isdigit(*regparse) ; regparse++) {
			max = max * 10 + (*regparse - '0');
		}
		reginsert(max, ret);
		next = OPERAND(ret);
		reginsert(min, ret);
		next = OPERAND(next);
		reginsert(MINMAX, ret);
		regtail(ret, OPERAND(next));		/* MINMAX->next = x */
	} else if (op == '?') {
		/* Emit x? as (x|) */
		reginsert(BRANCH, ret);			/* Either x */
		regtail(ret, regnode(BRANCH));		/* or */
		next = regnode(NOTHING);		/* null. */
		regtail(ret, next);
		regoptail(ret, next);
	}
	regparse++;
	if (ISMULT(*regparse)) {
		FAIL("nested *?+{");
	}

	return(ret);
}
开发者ID:jonathangray,项目名称:freebsd-1.x-ports,代码行数:81,代码来源:sre.c


示例6: main

int main(int argc, char *argv[])
{
	long hpage_size;
	int fd;
	void *p;
	volatile unsigned int *q;
	int err;
	int sigbus_count = 0;
	unsigned long initial_rsvd, rsvd;
	struct sigaction sa = {
		.sa_sigaction = sigbus_handler,
		.sa_flags = SA_SIGINFO,
	};

	test_init(argc, argv);

	hpage_size = check_hugepagesize();

	fd = hugetlbfs_unlinked_fd();
	if (fd < 0)
		FAIL("hugetlbfs_unlinked_fd()");

	initial_rsvd = get_huge_page_counter(hpage_size, HUGEPAGES_RSVD);
	verbose_printf("Reserve count before map: %lu\n", initial_rsvd);

	p = mmap(NULL, hpage_size, PROT_READ|PROT_WRITE, MAP_SHARED,
		 fd, 0);
	if (p == MAP_FAILED)
		FAIL("mmap(): %s", strerror(errno));
	q = p;

	verbose_printf("Reserve count after map: %lu\n",
		get_huge_page_counter(hpage_size, HUGEPAGES_RSVD));

	*q = 0;
	verbose_printf("Reserve count after touch: %lu\n",
		get_huge_page_counter(hpage_size, HUGEPAGES_RSVD));

	err = ftruncate(fd, 0);
	if (err)
		FAIL("ftruncate(): %s", strerror(errno));

	rsvd = get_huge_page_counter(hpage_size, HUGEPAGES_RSVD);
	verbose_printf("Reserve count after truncate: %lu\n", rsvd);
	if (rsvd != initial_rsvd)
		FAIL("Reserved count is not restored after truncate: %lu instead of %lu",
		     rsvd, initial_rsvd);

	err = sigaction(SIGBUS, &sa, NULL);
	if (err)
		FAIL("sigaction(): %s", strerror(errno));

	if (sigsetjmp(sig_escape, 1) == 0)
		*q; /* Fault, triggering a SIGBUS */
	else
		sigbus_count++;

	if (sigbus_count != 1)
		FAIL("Didn't SIGBUS after truncate");

	rsvd = get_huge_page_counter(hpage_size, HUGEPAGES_RSVD);
	verbose_printf("Reserve count after SIGBUS fault: %lu\n", rsvd);
	if (rsvd != initial_rsvd)
		FAIL("Reserved count is altered by SIGBUS fault: %lu instead of %lu",
		     rsvd, initial_rsvd);

	munmap(p, hpage_size);

	verbose_printf("Reserve count after munmap(): %lu\n",
		get_huge_page_counter(hpage_size, HUGEPAGES_RSVD));

	close(fd);

	verbose_printf("Reserve count after close(): %lu\n",
		get_huge_page_counter(hpage_size, HUGEPAGES_RSVD));

	PASS();
}
开发者ID:Maffblaster,项目名称:libhugetlbfs,代码行数:78,代码来源:truncate_reserve_wraparound.c


示例7: warningPrefix

//!	(internal,static)
void StreamerMMF::readVertexData(Mesh * mesh, Reader & in) {
	static const std::string warningPrefix("LoaderMMF::readVertexData: ");

	VertexDescription vd;

	for(uint32_t attrId = in.read_uint32(); attrId != StreamerMMF::MMF_END ; attrId = in.read_uint32()) {
		uint32_t numValues = in.read_uint32();
		uint32_t glType = in.read_uint32();
		uint32_t extLength = in.read_uint32();
		std::string name;

		switch(attrId) {
			case 0x00: {
					static const std::string s( VertexAttributeIds::POSITION.toString() );
					name = s;
					break;
				}
			case 0x01: {
					static const std::string s( VertexAttributeIds::NORMAL.toString() );
					name = s;
					break;
				}
			case 0x02: {
					static const std::string s( VertexAttributeIds::COLOR.toString() );
					name = s;
					break;
				}
			case 0x06: {
					static const std::string s( VertexAttributeIds::TEXCOORD0.toString() );
					name = s;
					break;
				}
			case 0x07: {
					static const std::string s( VertexAttributeIds::TEXCOORD1.toString() );
					name = s;
					break;
				}
			case MMF_CUSTOM_ATTR_ID: {
					break;
				}
			default: {
					WARN(warningPrefix+"Unknown attribute found.");
					break;
				}
		}


		while(extLength >= 8) {
			uint32_t extBlockType=in.read_uint32();
			uint32_t extBlockSize=in.read_uint32();
			extLength-=8;

			if(extLength>extBlockSize) {
				WARN(warningPrefix+"Error in vertex block");
				FAIL();
			}

			std::vector<uint8_t> data(extBlockSize);
			in.read(data.data(),extBlockSize);
			extLength-=extBlockSize;

			if(extBlockType==MMF_VERTEX_ATTR_EXT_NAME) {
				name.assign(data.begin(), data.end());
				name=name.substr(0,name.find('\0')); // remove additional zeros
			} else {
				WARN(warningPrefix+"Found unsupported ext data, skipping data.");
			}
		}
		if(extLength!=0) {
			WARN(warningPrefix+"Error in vertex block");
			FAIL();
		}
		if(name.empty())
			WARN(warningPrefix+"Found unnamed vertex attribute.");

		vd.appendAttribute(name,numValues,glType);
//        vd.setData(index, numValues, glType);

	}
	const uint32_t count = in.read_uint32();
	MeshVertexData & vertices = mesh->openVertexData();
	vertices.allocate(count,vd);

	in.read( vertices.data(), vertices.dataSize());

	vertices.updateBoundingBox();
}
开发者ID:MeisterYeti,项目名称:Rendering,代码行数:88,代码来源:StreamerMMF.cpp


示例8: udp_pull

void* udp_pull(void* leflux)
{
    struct flux * flux = (struct flux *) leflux;
	struct epoll_event ev;
	memset(&ev, 0, sizeof(struct epoll_event));
	int epollfd;

	epollfd = epoll_create(10);
	FAIL(epollfd);

	struct tabClients tabClientsUDP;
	tabClientsUDP.clients =
		(struct sockClient *)malloc(BASE_CLIENTS*sizeof(struct sockClient));
	memset(tabClientsUDP.clients, 0, sizeof(struct sockClient)*BASE_CLIENTS);
	tabClientsUDP.nbClients = 0;

	int baseCouranteUDP = BASE_CLIENTS;

	struct epoll_event events[MAX_EVENTS];

	flux->sock = createSockEventUDP(epollfd, flux->port);
	int sockData = socket(AF_INET, SOCK_DGRAM, 0);

	int nfds;
	int done = 0;

	while(done == 0) //Boucle principale
	{

		nfds = epoll_wait(epollfd, events, MAX_EVENTS, -1);
		FAIL(nfds);

		int n;

		for (n = 0; n < nfds; ++n)
		{
			if (events[n].events == EPOLLIN )
			{					
				char * buffer = (char *)malloc(512*sizeof(char));
				memset(buffer, '\0', 512);

				struct sockaddr_in faddr;
				memset(&faddr, 0, sizeof(struct sockaddr_in));
				socklen_t len = sizeof(faddr);

				FAIL(recvfrom(flux->sock, buffer, 512*sizeof(char),0, (struct sockaddr*)&faddr, &len));

				int j = 0;
				int trouve = -1;
				while((trouve == -1) && (j < tabClientsUDP.nbClients))
				{
					struct sockaddr_in * comp = &tabClientsUDP.clients[j].videoClient.orig_addr;
					if(faddr.sin_addr.s_addr == comp->sin_addr.s_addr 
							&& faddr.sin_family == comp->sin_family
							&& faddr.sin_port == comp->sin_port)
					{
						trouve = j;
					}
					j++;
				}
				if(trouve == -1)
				{
					if (tabClientsUDP.nbClients >= baseCouranteUDP)
					{
						baseCouranteUDP *=2;
						struct sockClient *  temp;
						temp = (struct sockClient *) realloc(tabClientsUDP.clients,
								baseCouranteUDP*sizeof(struct sockClient));
						if (temp!=NULL) 
						{
							tabClientsUDP.clients = temp;
						}
						else 
						{
							free (tabClientsUDP.clients);
							puts ("Error (re)allocating memory");
							exit (1);
						}
					}
					initReq(&(tabClientsUDP.clients[tabClientsUDP.nbClients].requete));
					memset(&tabClientsUDP.clients[tabClientsUDP.nbClients].videoClient.orig_addr,0,sizeof(struct sockaddr_in));
					memcpy(&tabClientsUDP.clients[tabClientsUDP.nbClients].videoClient.orig_addr, &faddr, sizeof(struct sockaddr_in));
					tabClientsUDP.clients[tabClientsUDP.nbClients].videoClient.clientSocket = sockData;
					
					tabClientsUDP.clients[tabClientsUDP.nbClients].videoClient.infosVideo = &flux->infosVideo;
					trouve = tabClientsUDP.nbClients++;
				}
				traiteChaine(buffer, &tabClientsUDP.clients[trouve].requete, &tabClientsUDP.clients[trouve].videoClient, 
						epollfd, 0);
			}

		}


	}
	return NULL;
}
开发者ID:Dorvaryn,项目名称:ServerVideo,代码行数:97,代码来源:udp_pull.c


示例9: TEST

TEST(ZxTestCAssertionsTest, Fail) {
    FAIL("Something bad happened\n");
    ZX_ASSERT_MSG(_ZXTEST_ABORT_IF_ERROR, "FAIL did not abort test execution");
    ZX_ASSERT_MSG(false, "_ZXTEST_ABORT_IF_ERROR not set on failure.");
}
开发者ID:saltstar,项目名称:smartnix,代码行数:5,代码来源:assertions_test.c


示例10: shiftprop

int
shiftprop(Flow *r)
{
	Flow *r1;
	Prog *p, *p1, *p2;
	int n, o;
	Adr a;

	p = r->prog;
	if(p->to.type != D_REG)
		FAIL("BOTCH: result not reg");
	n = p->to.reg;
	a = zprog.from;
	if(p->reg != NREG && p->reg != p->to.reg) {
		a.type = D_REG;
		a.reg = p->reg;
	}
	if(debug['P'])
		print("shiftprop\n%P", p);
	r1 = r;
	for(;;) {
		/* find first use of shift result; abort if shift operands or result are changed */
		r1 = uniqs(r1);
		if(r1 == nil)
			FAIL("branch");
		if(uniqp(r1) == nil)
			FAIL("merge");
		p1 = r1->prog;
		if(debug['P'])
			print("\n%P", p1);
		switch(copyu(p1, &p->to, A)) {
		case 0:	/* not used or set */
			if((p->from.type == D_REG && copyu(p1, &p->from, A) > 1) ||
			   (a.type == D_REG && copyu(p1, &a, A) > 1))
				FAIL("args modified");
			continue;
		case 3:	/* set, not used */
			FAIL("BOTCH: noref");
		}
		break;
	}
	/* check whether substitution can be done */
	switch(p1->as) {
	default:
		FAIL("non-dpi");
	case AAND:
	case AEOR:
	case AADD:
	case AADC:
	case AORR:
	case ASUB:
	case ASBC:
	case ARSB:
	case ARSC:
		if(p1->reg == n || (p1->reg == NREG && p1->to.type == D_REG && p1->to.reg == n)) {
			if(p1->from.type != D_REG)
				FAIL("can't swap");
			p1->reg = p1->from.reg;
			p1->from.reg = n;
			switch(p1->as) {
			case ASUB:
				p1->as = ARSB;
				break;
			case ARSB:
				p1->as = ASUB;
				break;
			case ASBC:
				p1->as = ARSC;
				break;
			case ARSC:
				p1->as = ASBC;
				break;
			}
			if(debug['P'])
				print("\t=>%P", p1);
		}
	case ABIC:
	case ATST:
	case ACMP:
	case ACMN:
		if(p1->reg == n)
			FAIL("can't swap");
		if(p1->reg == NREG && p1->to.reg == n)
			FAIL("shift result used twice");
//	case AMVN:
		if(p1->from.type == D_SHIFT)
			FAIL("shift result used in shift");
		if(p1->from.type != D_REG || p1->from.reg != n)
			FAIL("BOTCH: where is it used?");
		break;
	}
	/* check whether shift result is used subsequently */
	p2 = p1;
	if(p1->to.reg != n)
	for (;;) {
		r1 = uniqs(r1);
		if(r1 == nil)
			FAIL("inconclusive");
		p1 = r1->prog;
		if(debug['P'])
//.........这里部分代码省略.........
开发者ID:cloudaice,项目名称:golang,代码行数:101,代码来源:peep.c


示例11: test_capmode

int
test_capmode(void)
{
	struct statfs statfs;
	struct stat sb;
	long sysarch_arg = 0;
	int fd_close, fd_dir, fd_file, fd_socket, fd2[2];
	int success = PASSED;
	pid_t pid, wpid;
	char ch;

	/* Open some files to play with. */
	REQUIRE(fd_file = open("/tmp/cap_capmode", O_RDWR|O_CREAT, 0644));
	REQUIRE(fd_close = open("/dev/null", O_RDWR));
	REQUIRE(fd_dir = open("/tmp", O_RDONLY));
	REQUIRE(fd_socket = socket(PF_INET, SOCK_DGRAM, 0));

	/* Enter capability mode. */
	REQUIRE(cap_enter());

	/*
	 * System calls that are not permitted in capability mode.
	 */
	CHECK_CAPMODE(access, "/tmp/cap_capmode_access", F_OK);
	CHECK_CAPMODE(acct, "/tmp/cap_capmode_acct");
	CHECK_CAPMODE(bind, PF_INET, NULL, 0);
	CHECK_CAPMODE(chdir, "/tmp/cap_capmode_chdir");
	CHECK_CAPMODE(chflags, "/tmp/cap_capmode_chflags", UF_NODUMP);
	CHECK_CAPMODE(chmod, "/tmp/cap_capmode_chmod", 0644);
	CHECK_CAPMODE(chown, "/tmp/cap_capmode_chown", -1, -1);
	CHECK_CAPMODE(chroot, "/tmp/cap_capmode_chroot");
	CHECK_CAPMODE(connect, PF_INET, NULL, 0);
	CHECK_CAPMODE(creat, "/tmp/cap_capmode_creat", 0644);
	CHECK_CAPMODE(fchdir, fd_dir);
	CHECK_CAPMODE(getfsstat, &statfs, sizeof(statfs), MNT_NOWAIT);
	CHECK_CAPMODE(link, "/tmp/foo", "/tmp/bar");
	CHECK_CAPMODE(lstat, "/tmp/cap_capmode_lstat", &sb);
	CHECK_CAPMODE(mknod, "/tmp/capmode_mknod", 06440, 0);
	CHECK_CAPMODE(mount, "procfs", "/not_mounted", 0, NULL);
	CHECK_CAPMODE(open, "/dev/null", O_RDWR);
	CHECK_CAPMODE(readlink, "/tmp/cap_capmode_readlink", NULL, 0);
	CHECK_CAPMODE(revoke, "/tmp/cap_capmode_revoke");
	CHECK_CAPMODE(stat, "/tmp/cap_capmode_stat", &sb);
	CHECK_CAPMODE(symlink,
	    "/tmp/cap_capmode_symlink_from",
	    "/tmp/cap_capmode_symlink_to");
	CHECK_CAPMODE(unlink, "/tmp/cap_capmode_unlink");
	CHECK_CAPMODE(unmount, "/not_mounted", 0);

	/*
	 * System calls that are permitted in capability mode.
	 */
	CHECK_SYSCALL_SUCCEEDS(close, fd_close);
	CHECK_SYSCALL_SUCCEEDS(dup, fd_file);
	CHECK_SYSCALL_SUCCEEDS(fstat, fd_file, &sb);
	CHECK_SYSCALL_SUCCEEDS(lseek, fd_file, 0, SEEK_SET);
	CHECK_SYSCALL_SUCCEEDS(msync, &fd_file, 8192, MS_ASYNC);
	CHECK_SYSCALL_SUCCEEDS(profil, NULL, 0, 0, 0);
	CHECK_SYSCALL_SUCCEEDS(read, fd_file, &ch, sizeof(ch));
	CHECK_SYSCALL_SUCCEEDS(recvfrom, fd_socket, NULL, 0, 0, NULL, NULL);
	CHECK_SYSCALL_SUCCEEDS(setuid, getuid());
	CHECK_SYSCALL_SUCCEEDS(write, fd_file, &ch, sizeof(ch));

	/*
	 * These calls will fail for lack of e.g. a proper name to send to,
	 * but they are allowed in capability mode, so errno != ECAPMODE.
	 */
	CHECK_NOT_CAPMODE(accept, fd_socket, NULL, NULL);
	CHECK_NOT_CAPMODE(getpeername, fd_socket, NULL, NULL);
	CHECK_NOT_CAPMODE(getsockname, fd_socket, NULL, NULL);
	CHECK_NOT_CAPMODE(fchflags, fd_file, UF_NODUMP);
	CHECK_NOT_CAPMODE(recvmsg, fd_socket, NULL, 0);
	CHECK_NOT_CAPMODE(sendmsg, fd_socket, NULL, 0);
	CHECK_NOT_CAPMODE(sendto, fd_socket, NULL, 0, 0, NULL, 0);

	/*
	 * System calls which should be allowed in capability mode, but which
	 * don't return errors, and are thus difficult to check.
	 *
	 * We will try anyway, by checking errno.
	 */
	CHECK_SYSCALL_VOID_NOT_ECAPMODE(getegid);
	CHECK_SYSCALL_VOID_NOT_ECAPMODE(geteuid);
	CHECK_SYSCALL_VOID_NOT_ECAPMODE(getgid);
	CHECK_SYSCALL_VOID_NOT_ECAPMODE(getpid);
	CHECK_SYSCALL_VOID_NOT_ECAPMODE(getppid);
	CHECK_SYSCALL_VOID_NOT_ECAPMODE(getuid);

	/*
	 * Finally, tests for system calls that don't fit the pattern very well.
	 */
	pid = fork();
	if (pid >= 0) {
		if (pid == 0) {
			exit(0);
		} else if (pid > 0) {
			wpid = waitpid(pid, NULL, 0);
			if (wpid < 0) {
				if (errno != ECAPMODE)
					FAIL("capmode:waitpid");
//.........这里部分代码省略.........
开发者ID:coyizumi,项目名称:cs111,代码行数:101,代码来源:cap_test_capmode.c


示例12: test205

/* ------------------------- */
STATIC void test205()
{
u_int16_t vol = VolID;
DSI *dsi = &Conn->dsi;
u_int16_t ret;
char *tp;

	enter_test();
    fprintf(stdout,"===================\n");
    fprintf(stdout,"FPOpenVol:t205: Open Volume call\n");

    FAIL (FPCloseVol(Conn, vol));
	/* --------- */
    ret = FPOpenVolFull(Conn, Vol, 0);
    if (ret != 0xffff || dsi->header.dsi_code != htonl(AFPERR_BITMAP)) {
		failed();    
    }
	
	if (ret != 0xffff) {
    	FAIL (FPCloseVol(Conn, ret));
	}
	/* --------- */
    ret = FPOpenVolFull(Conn, Vol, 0xffff);
    if (ret != 0xffff || dsi->header.dsi_code != htonl(AFPERR_BITMAP)) {
		failed();    
    }
	if (ret != 0xffff) {
    	FAIL (FPCloseVol(Conn, ret));
	}
	/* --------- */
	tp = strdup(Vol);
	if (!tp) {
		goto fin;
	}
	*tp = *tp +1;
    ret = FPOpenVol(Conn, tp);
	free(tp);
    if (ret != 0xffff || dsi->header.dsi_code != htonl(AFPERR_NOOBJ)) {
		failed();    
    }
	if (ret != 0xffff) {
    	FAIL (FPCloseVol(Conn, ret));
	}
	/* -------------- */
	ret = FPOpenVol(Conn, Vol);
	if (ret == 0xffff) {
		failed();
	}
	vol = FPOpenVol(Conn, Vol);
	if (vol != ret) {
		fprintf(stdout,"\tFAILED double open != volume id\n");
		failed_nomsg();
	}	
    FAIL (FPCloseVol(Conn, ret));
    FAIL (!FPCloseVol(Conn, ret));
fin:
	ret = VolID = FPOpenVol(Conn, Vol);
	if (ret == 0xffff) {
		failed();
	}
	exit_test("test205");
}
开发者ID:Netatalk,项目名称:test-suite,代码行数:63,代码来源:FPOpenVol.c


示例13: VTIM_parse

double
VTIM_parse(const char *p)
{
	double t;
	int month = 0, year = 0, weekday = -1, mday = 0;
	int hour = 0, min = 0, sec = 0;
	int d, leap;

	while (*p == ' ')
		p++;

	if (*p >= '0' && *p <= '9') {
		/* ISO8601 -- "1994-11-06T08:49:37" */
		DIGIT(1000, year);
		DIGIT(100, year);
		DIGIT(10, year);
		DIGIT(1, year);
		MUSTBE('-');
		DIGIT(10, month);
		DIGIT(1, month);
		MUSTBE('-');
		DIGIT(10, mday);
		DIGIT(1, mday);
		MUSTBE('T');
		TIMESTAMP();
	} else {
		WEEKDAY();
		assert(weekday >= 0 && weekday <= 6);
		if (*p == ',') {
			/* RFC822 & RFC1123 - "Sun, 06 Nov 1994 08:49:37 GMT" */
			p++;
			MUSTBE(' ');
			DIGIT(10, mday);
			DIGIT(1, mday);
			MUSTBE(' ');
			MONTH();
			MUSTBE(' ');
			DIGIT(1000, year);
			DIGIT(100, year);
			DIGIT(10, year);
			DIGIT(1, year);
			MUSTBE(' ');
			TIMESTAMP();
			MUSTBE(' ');
			MUSTBE('G');
			MUSTBE('M');
			MUSTBE('T');
		} else if (*p == ' ') {
			/* ANSI-C asctime() -- "Sun Nov  6 08:49:37 1994" */
			p++;
			MONTH();
			MUSTBE(' ');
			if (*p != ' ')
				DIGIT(10, mday);
			else
				p++;
			DIGIT(1, mday);
			MUSTBE(' ');
			TIMESTAMP();
			MUSTBE(' ');
			DIGIT(1000, year);
			DIGIT(100, year);
			DIGIT(10, year);
			DIGIT(1, year);
		} else if (!memcmp(p, more_weekday[weekday],
		    strlen(more_weekday[weekday]))) {
			/* RFC850 -- "Sunday, 06-Nov-94 08:49:37 GMT" */
			p += strlen(more_weekday[weekday]);
			MUSTBE(',');
			MUSTBE(' ');
			DIGIT(10, mday);
			DIGIT(1, mday);
			MUSTBE('-');
			MONTH();
			MUSTBE('-');
			DIGIT(10, year);
			DIGIT(1, year);
			year += 1900;
			if (year < 1969)
				year += 100;
			MUSTBE(' ');
			TIMESTAMP();
			MUSTBE(' ');
			MUSTBE('G');
			MUSTBE('M');
			MUSTBE('T');
		} else
			FAIL();
	}

	while (*p == ' ')
		p++;

	if (*p != '\0')
		FAIL();

	if (sec < 0 || sec > 60)	/* Leapseconds! */
		FAIL();
	if (min < 0 || min > 59)
		FAIL();
//.........这里部分代码省略.........
开发者ID:Dridi,项目名称:varnish-cache,代码行数:101,代码来源:vtim.c


示例14: __ALFFXLOGSTRING1

THuiFxFilterType CHuiFxEffectParser::GetFilterTypeL( CMDXMLNode* aNode )
    {
#ifdef _HUI_FX_PARSER_LOGGING
    __ALFFXLOGSTRING1("CHuiFxEffectParser::GetFilterTypeL - 0x%x",this);
#endif
    if (aNode->NodeType() != CMDXMLNode::EElementNode)
        {
        FAIL(KErrGeneral, _L("Text node expected while reading filter type"));
        }
    
    TInt attributeIndex = ((CMDXMLElement*)aNode)->FindIndex( KLitType );

    if (attributeIndex == KErrNotFound)
        {
        FAIL(KErrGeneral, _L("Filter type not found"));
        }
    
    TPtrC attributeValue;
    TPtrC attributeName;
    User::LeaveIfError(((CMDXMLElement*)aNode)->AttributeDetails( attributeIndex, attributeName, attributeValue));

    if( attributeValue.Compare( KLitDesaturate ) == 0 )
        {
        return EFilterTypeDesaturate;
        }
    else if( attributeValue.Compare( KLitBlur ) == 0 )
        {
        return EFilterTypeBlur;
        }
    else if( attributeValue.Compare( KLitGlow ) == 0 )
        {
        return EFilterTypeGlow;
        }
    else if( attributeValue.Compare( KLitBrightnessContrast ) == 0 )
        {
        return EFilterTypeBrightnessContrast;
        }
    else if( attributeValue.Compare( KlitHSL ) == 0 )
        {
        return EFilterTypeHSL;
        }
    else if( attributeValue.Compare( KlitColorize ) == 0 )
        {
        return EFilterTypeColorize;
        }
    else if( attributeValue.Compare( KlitOutline ) == 0 )
        {
        return EFilterTypeOutline;
        }
    else if( attributeValue.Compare( KLitDropShadow ) == 0 )
        {
        // drop shadow is generated using outline filter
        return EFilterTypeOutline;
        }
    else if( attributeValue.Compare( KlitBevel ) == 0 )
        {
        return EFilterTypeBevel;
        }
    else if ( attributeValue.Compare ( KlitTransform ) == 0 )
        {
        return EFilterTypeTransform;
        }
    else
        {
        return EFilterTypeUnknown;
        }
    }
开发者ID:cdaffara,项目名称:symbiandump-mw4,代码行数:67,代码来源:HuiFxEffectParser.cpp


示例15: fuzzy_hash_test

TEST fuzzy_hash_test(long size, long btree_node_size, int _commit)
{
	INIT();

	long *elements = malloc(sizeof(long) * size);
	long *nonelements = malloc(sizeof(long) * size);
	long *values = malloc(sizeof(long) * size);
	void **flatten_scores = malloc(sizeof(void *) * size);

	long btree_page = db->next_empty_page;
	RL_CALL_VERBOSE(rl_write, RL_OK, db, btree->type->btree_type, btree_page, btree);

	long i, element, value, *element_copy, *value_copy;

	long j, flatten_size;

	void *val, *tmp;

	for (i = 0; i < size; i++) {
		element = rand();
		value = rand();
		if (contains_element(element, elements, i)) {
			i--;
			continue;
		}
		else {
			RL_CALL_VERBOSE(rl_read, RL_FOUND, db, &rl_data_type_btree_hash_long_long, btree_page, &rl_btree_type_hash_long_long, &tmp, 1);
			elements[i] = element;
			element_copy = malloc(sizeof(long));
			*element_copy = element;
			values[i] = value;
			value_copy = malloc(sizeof(long));
			*value_copy = value;
			RL_CALL_VERBOSE(rl_btree_add_element, RL_OK, db, btree, btree_page, element_copy, value_copy);
			RL_CALL_VERBOSE(rl_btree_is_balanced, RL_OK, db, btree);
		}
		flatten_size = 0;
		RL_CALL_VERBOSE(rl_flatten_btree, RL_OK, db, btree, &flatten_scores, &flatten_size);
		for (j = 1; j < flatten_size; j++) {
			if (*(long *)flatten_scores[j - 1] >= *(long *)flatten_scores[j]) {
				fprintf(stderr, "Tree is in a bad state in element %ld after adding child %ld\n", j, i);
				retval = RL_UNEXPECTED;
				goto cleanup;
			}
		}
		if (_commit) {
			RL_CALL_VERBOSE(rl_commit, RL_OK, db);
			RL_CALL_VERBOSE(rl_read, RL_FOUND, db, &rl_data_type_btree_hash_long_long, btree_page, &rl_btree_type_hash_long_long, &tmp, 1);
			btree = tmp;
		}
	}

	for (i = 0; i < size; i++) {
		element = rand();
		if (contains_element(element, elements, size) || contains_element(element, nonelements, i)) {
			i--;
		}
		else {
			nonelements[i] = element;
		}
	}

	for (i = 0; i < size; i++) {
		RL_CALL_VERBOSE(rl_btree_find_score, RL_FOUND, db, btree, &elements[i], &val, NULL, NULL);
		EXPECT_LONG(*(long *)val, values[i]);
		RL_CALL_VERBOSE(rl_btree_find_score, RL_NOT_FOUND, db, btree, &nonelements[i], NULL, NULL, NULL);
	}

	retval = 0;
cleanup:
	free(values);
	free(elements);
	free(nonelements);
	free(flatten_scores);
	rl_close(db);
	if (retval == 0) { PASS(); } else { FAIL(); }
}
开发者ID:pombredanne,项目名称:rlite,代码行数:77,代码来源:btree-test.c


示例16: gc_execute_line

// Executes one line of 0-terminated G-Code. The line is assumed to contain only uppercase
// characters and signed floating point values (no whitespace). Comments and block delete
// characters have been removed. In this function, all units and positions are converted and 
// exported to grbl's internal functions in terms of (mm, mm/min) and absolute machine 
// coordinates, respectively.
uint8_t gc_execute_line(char *line) 
{
  /* -------------------------------------------------------------------------------------
     STEP 1: Initialize parser block struct and copy current g-code state modes. The parser
     updates these modes and commands as the block line is parser and will only be used and
     executed after successful error-checking. The parser block struct also contains a block
     values struct, word tracking variables, and a non-modal commands tracker for the new 
     block. This struct contains all of the necessary information to execute the block. */
     
  memset(&gc_block, 0, sizeof(gc_block)); // Initialize the parser block struct.
  memcpy(&gc_block.modal,&gc_state.modal,sizeof(gc_modal_t)); // Copy current modes
  uint8_t axis_command = AXIS_COMMAND_NONE;
  uint8_t axis_0, axis_1, axis_linear;
  uint8_t coord_select = 0; // Tracks G10 P coordinate selection for execution
  float coordinate_data[N_AXIS]; // Multi-use variable to store coordinate data for execution
  float parameter_data[N_AXIS]; // Multi-use variable to store parameter data for execution
  
  // Initialize bitflag tracking variables for axis indices compatible operations.
  uint8_t axis_words = 0; // XYZ tracking

  // Initialize command and value words variables. Tracks words contained in this block.
  uint16_t command_words = 0; // G and M command words. Also used for modal group violations.
  uint16_t value_words = 0; // Value words. 

  /* -------------------------------------------------------------------------------------
     STEP 2: Import all g-code words in the block line. A g-code word is a letter followed by
     a number, which can either be a 'G'/'M' command or sets/assigns a command value. Also, 
     perform initial error-checks for command word modal group violations, for any repeated
     words, and for negative values set for the value words F, N, P, T, and S. */
     
  uint8_t word_bit; // Bit-value for assigning tracking variables
  uint8_t char_counter = 0;  
  char letter;
  float value;
  uint8_t int_value = 0;
  uint8_t mantissa = 0; // NOTE: For mantissa values > 255, variable type must be changed to uint16_t.


  while (line[char_counter] != 0) { // Loop until no more g-code words in line.
    
    // Import the next g-code word, expecting a letter followed by a value. Otherwise, error out.
    letter = line[char_counter];
    if((letter < 'A') || (letter > 'Z')) { FAIL(STATUS_EXPECTED_COMMAND_LETTER); } // [Expected word letter]
    char_counter++;
    if (!read_float(line, &char_counter, &value)) { FAIL(STATUS_BAD_NUMBER_FORMAT); } // [Expected word value]

    // Convert values to smaller uint8 significand and mantissa values for parsing this word.
    // NOTE: Mantissa is multiplied by 100 to catch non-integer command values. This is more 
    // accurate than the NIST gcode requirement of x10 when used for commands, but not quite
    // accurate enough for value words that require integers to within 0.0001. This should be
    // a good enough comprimise and catch most all non-integer errors. To make it compliant, 
    // we would simply need to change the mantissa to int16, but this add compiled flash space.
    // Maybe update this later. 
    int_value = trunc(value);
    mantissa =  round(100*(value - int_value)); // Compute mantissa for Gxx.x commands.
    // NOTE: Rounding must be used to catch small floating point errors. 
    // Check if the g-code word is supported or errors due to modal group violations or has
    // been repeated in the g-code block. If ok, update the command or record its value.
    switch(letter) {
    
      /* 'G' and 'M' Command Words: Parse commands and check for modal group violations.
         NOTE: Modal group numbers are defined in Table 4 of NIST RS274-NGC v3, pg.20 */
         
      case 'G':
        // Determine 'G' command and its modal group
        switch(int_value) {
          case 1:
            if (axis_command) { FAIL(STATUS_GCODE_AXIS_COMMAND_CONFLICT); } // [Axis word/command conflict]
            axis_command = AXIS_COMMAND_MOTION_MODE; 
            gc_block.modal.motion = MOTION_MODE_LINEAR;
            word_bit = MODAL_GROUP_G1; 

            break;
          default: FAIL(STATUS_GCODE_UNSUPPORTED_COMMAND); // [Unsupported G command]
        }  
        if (mantissa > 0) { FAIL(STATUS_GCODE_COMMAND_VALUE_NOT_INTEGER); } // [Unsupported or invalid Gxx.x command]
        // Check for more than one command per modal group violations in the current block
        // NOTE: Variable 'word_bit' is always assigned, if the command is valid.
        if ( bit_istrue(command_words,bit(word_bit)) ) { FAIL(STATUS_GCODE_MODAL_GROUP_VIOLATION); }
        command_words |= bit(word_bit);
        break;
        
      case 'M':
        // Determine 'M' command and its modal group
        if (mantissa > 0) { FAIL(STATUS_GCODE_COMMAND_VALUE_NOT_INTEGER); } // [No Mxx.x commands]
        switch(int_value) {
          case 0: case 2:
            word_bit = MODAL_GROUP_M4; 
            switch(int_value) {
              case 0: gc_block.modal.program_flow = PROGRAM_FLOW_PAUSED; break; // Program pause
              case 2: gc_block.modal.program_flow = PROGRAM_FLOW_COMPLETED; break; // Program end and reset 
            }
            break;
          case 17: gc_block.modal.motor = MOTOR_ENABLE; break;
          case 18: gc_block.modal.motor = MOTOR_DISABLE; break;
//.........这里部分代码省略.........
开发者ID:DeeibyCoper,项目名称:horus-fw,代码行数:101,代码来源:gcode.c


示例17: fuzzy_hash_test_iterator

TEST fuzzy_hash_test_iterator(long size, long btree_node_size, int _commit)
{
	INIT();

	rl_btree_iterator *iterator = NULL;
	long *elements = malloc(sizeof(long) * size);
	long *nonelements = malloc(sizeof(long) * size);
	long *values = malloc(sizeof(long) * size);

	long btree_page = db->next_empty_page;
	RL_CALL_VERBOSE(rl_write, RL_OK, db, btree->type->btree_type, btree_page, btree);

	long i, element, value, *element_copy, *value_copy;

	long j;

	void *tmp;
	long prev_score = -1.0, score;

	for (i = 0; i < size; i++) {
		element = rand();
		value = rand();
		if (contains_element(element, elements, i))  

鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ FAILED函数代码示例发布时间:2022-05-30
下一篇:
C++ FABS函数代码示例发布时间: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