예제 #1
0
 void object::test<test_id_ge>()
 {
     ensure_ge("ge int", 1, 1);
     ensure_ge("ge int", 2, 1);
     ensure_ge("ge str", str("a"), "a");
     ensure_ge("ge str", str("b"), "a");
     ensure_throws<failure>
       ("ensure_ge should fail here", []() {
         ensure_ge("ge int", 1, 2);
       });
 }
예제 #2
0
void for_chapter(
	void* udata,
	identifier chapter,
	git_time_t chapter_timestamp) {
	GDERP;
	SPAM("chapter %.*s %lu timestamp %d",
			 g->location.l,g->location.s,
			 chapter,chapter_timestamp - g->timestamp);
	g->any_chapter = true;
	//SPAM("chap %d:%d\n",chapter,chapter_timestamp);
	if(chapter_timestamp > g->max_timestamp)
		g->max_timestamp = chapter_timestamp;
	// this should be moved later...
	char srcname[0x100];
	struct stat srcinfo;
	int src;

	bool setupsrc(void) {
		snprintf(srcname,0x100,"chapter%ld.hish",chapter);
		src = openat(g->srcloc, srcname, O_RDONLY, 0755);
		ensure_ge(src,0);
		// for adjusting dest timestamp
		ensure0(fstatat(g->srcloc,srcname,&srcinfo,0));
		if(srcinfo.st_mtime > chapter_timestamp) {
			// git ruins file modification times... we probably cloned this, and lost
			// all timestamps. Just set the source file to have changed with the commit then.
			srcinfo.st_mtime = chapter_timestamp;
			return true;
		}
		return false;
	}