예제 #1
0
파일: test.c 프로젝트: avsej/hashset.c
static void trivial(void)
{
    char *missing = "missing";
    char *items[] = {"zero", "one", "two", "three", NULL};
    char *foo = "foo";
    size_t ii, nitems = 4;
    hashset_t set = hashset_create();

    if (set == NULL) {
        fprintf(stderr, "failed to create hashset instance\n");
        abort();
    }

    for (ii = 0; ii < nitems; ++ii) {
        hashset_add(set, items[ii]);
    }

    for (ii = 0; ii < nitems; ++ii) {
        assert(hashset_is_member(set, items[ii]));
    }
    assert(hashset_is_member(set, missing) == 0);

    assert(hashset_remove(set, items[1]) == 1);
    assert(hashset_num_items(set) == 3);
    assert(hashset_remove(set, items[1]) == 0);

    assert(hashset_add(set, foo) == 1);
    assert(hashset_add(set, foo) == 0);

    hashset_destroy(set);
}
예제 #2
0
void test_hashset_add()
{
    HashSet *hs = hashset_new();

    char *a = "foo";
    char *b = "bar";
    char *c = "baz";
    char *d = "foo";

    hashset_add(hs, a);
    hashset_add(hs, b);
    hashset_add(hs, c);
    hashset_add(hs, d);

    size_t size = hashset_size(hs);

    cc_assert(size == 3,
              cc_msg("hashset_add: Expected size was 3, but got %d",
                     size));

    cc_assert(hashset_contains(hs, a) &&
              hashset_contains(hs, d),
              cc_msg("hashset_add: HashSet expected to contain elemnts"
                     " %s and %s", a, d));

    hashset_destroy(hs);
}
예제 #3
0
void test_hashset_iter_remove()
{
    HashSet *hs = hashset_new();

    char *a = "foo";
    char *b = "bar";
    char *c = "baz";

    hashset_add(hs, a);
    hashset_add(hs, b);
    hashset_add(hs, c);

    HashSetIter iter;
    hashset_iter_init(&iter, hs);

    while (hashset_iter_has_next(&iter)) {
        char const *e = hashset_iter_next(&iter);

        if (!strcmp(e, "bar"))
            hashset_iter_remove(&iter);
    }

    cc_assert(hashset_size(hs) == 2,
              cc_msg("hashset_iter: Expected size 2 but got %d ",
                     hashset_size(hs)));

    cc_assert(!hashset_contains(hs, "bar"),
              cc_msg("hashset_iter: Element (%s) still pressent "
                     "after removal", "bar"));

    hashset_destroy(hs);
}
예제 #4
0
void test_hashset_remove_all()
{
    HashSet *hs = hashset_new();

    char *a = "foo";
    char *b = "bar";
    char *c = "baz";
    char *d = "foo";

    hashset_add(hs, a);
    hashset_add(hs, b);
    hashset_add(hs, c);
    hashset_add(hs, d);

    hashset_remove_all(hs);

    size_t size = hashset_size(hs);

    cc_assert(size == 0,
              cc_msg("hashset_add: Expected size was 0, but got %d",
                     size));

    cc_assert(!hashset_contains(hs, "bar") &&
              !hashset_contains(hs, c),
              cc_msg("hashset_add: HashSet not empty after removing"
                     " all elements"));

    hashset_destroy(hs);
}
void test_hashset_iter_remove()
{
    HashSet *hs;
    hashset_new(&hs);

    char *a = "foo";
    char *b = "bar";
    char *c = "baz";

    hashset_add(hs, a);
    hashset_add(hs, b);
    hashset_add(hs, c);

    HashSetIter iter;
    hashset_iter_init(&iter, hs);

    char *e;
    while (hashset_iter_next(&iter, (void*) &e) != CC_ITER_END) {
        if (!strcmp(e, "bar"))
            hashset_iter_remove(&iter, NULL);
    }

    cc_assert(hashset_size(hs) == 2,
              cc_msg("hashset_iter: Expected size 2 but got %d ",
                     hashset_size(hs)));

    cc_assert(!hashset_contains(hs, "bar"),
              cc_msg("hashset_iter: Element (%s) still pressent "
                     "after removal", "bar"));

    hashset_destroy(hs);
}
예제 #6
0
void test_hashset_remove()
{
    HashSet *hs = hashset_new();

    char *a = "foo";
    char *b = "bar";
    char *c = "baz";
    char *d = "foo";

    hashset_add(hs, a);
    hashset_add(hs, b);
    hashset_add(hs, c);
    hashset_add(hs, d);

    hashset_remove(hs, "bar");

    size_t size = hashset_size(hs);

    cc_assert(size == 2,
              cc_msg("hashset_add: Expected size was 2, but got %d",
                     size));

    cc_assert(!hashset_contains(hs, "bar"),
              cc_msg("hashset_add: HashSet not expected to contain "
                     "element %s", "foo"));

    hashset_destroy(hs);
}
예제 #7
0
void favorites_destroy(FavoriteItems* favorites)
{
    if(favorites) {
        // TODO hashset destroys keys - no need to destroy items!
        unsigned i;
        for(i=0; i<favorites->count; i++) {
            free(favorites->items[i]);
        }
        free(favorites->items);
        hashset_destroy(favorites->set, false);
        free(favorites->set);
        free(favorites);
    }
}
예제 #8
0
void run() {

  unsigned i, time;
  gasnett_tick_t start, end;

  hashset_create(params[HASHSET_SIZE], params[ON_PTHREAD]);

  BARRIER();

  start = gasnett_ticks_now();
  for (i = 0; i < MY_NUM_OPS; ++i) {
    if (put_flags[i] == GRT_TRUE) {
      hashset_insert(numbers[i]);
    } else {
      hashset_find(numbers[i]);
    }
  }
  end = gasnett_ticks_now();
  time = ((unsigned) gasnett_ticks_to_us(end - start));
  //printf("processor %u: execution time=%f us\n", 
  //	 grt_id, (double) time);
  fflush(stdout);
  grt_write(0, time, &times[grt_id]);

  BARRIER();

  if (grt_id == 0) {
    time = 0, max_time = 0;
    for (i = 0; i < grt_num_procs; ++i) {
      gasnett_tick_t this_time = times[i];
      time += this_time;
      if (this_time >= max_time) max_time = this_time;
    }
    time_per_op = ((float) time) / params[NUM_OPS];
    printf("total CPU time=%f us\n", (double) time);
    printf("time per operation=%f us\n", time_per_op);
    printf("max time=%f us\n", (double) max_time);
  }

  BARRIER();

  hashset_destroy();

  BARRIER();

}
예제 #9
0
hashset_t hashset_create()
{
    hashset_t set = calloc(1, sizeof(struct hashset_st));

    if (set == NULL) {
        return NULL;
    }
    set->nbits = 3;
    set->capacity = (size_t)(1 << set->nbits);
    set->mask = set->capacity - 1;
    set->items = calloc(set->capacity, sizeof(size_t));
    if (set->items == NULL) {
        hashset_destroy(set);
        return NULL;
    }
    set->nitems = 0;
    return set;
}
예제 #10
0
int main(int argc, char** argv) {
  hashset_init(argc, argv, 4);

  struct timeval tv;
  gettimeofday(&tv, 0);
  srand(tv.tv_usec);
  unsigned i;

#ifdef PTHREAD
  hashset_create(TABLE_SIZE, GRT_TRUE);
#else
  hashset_create(TABLE_SIZE, GRT_FALSE);
#endif

  BARRIER();

  grt_debug_print("generating numbers\n");
  for (i = 0; i < N; ++i) {
    numbers[i] = rand();
  }
  grt_debug_print("inserting numbers\n");
  for (i = 0; i < N; ++i) {
    hashset_insert(numbers[i]);
  }

  BARRIER();

  grt_debug_print("finding numbers\n");
  for (i = 0; i < N; ++i) {
    grt_word_t num = numbers[i];
    unsigned found = hashset_find(num);
    if (!found) {
      fprintf(stderr, "processor %d: expected to find %llx\n", 
	      grt_id, num);
    } 
  }

  BARRIER();

  grt_debug_print("done\n");
  hashset_destroy();

  hashset_exit(0);
}
예제 #11
0
파일: test.c 프로젝트: avsej/hashset.c
static void test_fill_with_deleted_items()
{
    char *s = "some string";
    hashset_t set = hashset_create();
    if (set == NULL)
        abort();

    /* fill `set` with deleted items */
    for (int i = 0; i < 8; ++i)
    {
        hashset_add(set, s + i);
        hashset_remove(set, s + i);
    }

    /* this should not cause an infinite loop */
    assert(hashset_is_member(set, s) == 0);

    hashset_destroy(set);
}
예제 #12
0
void test_hashset_new()
{
    HashSetConf conf;
    hashset_conf_init(&conf);
    conf.initial_capacity = 7;

    HashSet *set = hashset_new_conf(&conf);

    cc_assert(hashset_size(set) == 0,
              cc_msg("hashset_new: Initial size not 0"));

    size_t capacity = hashset_capacity(set);

    /* power of 2 rounding */
    cc_assert(capacity == 8,
              cc_msg("hashset_new: Expected capactity was 8, but got %d",
                     capacity));

    hashset_destroy(set);
}
예제 #13
0
void test_hashset_iter_next()
{
    HashSet *hs = hashset_new();

    char *a = "foo";
    char *b = "bar";
    char *c = "baz";

    hashset_add(hs, a);
    hashset_add(hs, b);
    hashset_add(hs, c);

    size_t x = 0;
    size_t y = 0;
    size_t z = 0;

    HashSetIter iter;
    hashset_iter_init(&iter, hs);

    while (hashset_iter_has_next(&iter)) {
        char const *e = hashset_iter_next(&iter);

        if (!strcmp(e, "foo"))
            x++;

        if (!strcmp(e, "bar"))
            y++;

        if (!strcmp(e, "baz"))
            z++;
    }

    cc_assert((x == 1) && (y == 1) && (z == 1),
              cc_msg("hashset_iter: Unexpected number of "
                     "elements returned by the iterator"));

    hashset_destroy(hs);
}
예제 #14
0
int crawl(char *start_url, int download_workers, int parse_workers, int queue_size,
    char *(*_fetch_fn)(char *url), void (*_edge_fn)(char *from, char *to)) {
    int i;

    bounded_buffer_t url_queue;
    unbounded_buffer_t page_queue;
    hashset_t url_set;
    bounded_buffer_init(&url_queue, queue_size);
    unbounded_buffer_init(&page_queue);
    hashset_init(&url_set, HASHSET_BUCKETS);

    bounded_buffer_put(&url_queue, (void *)str_duplicate(start_url));

    mutex_t done_mutex;
    cond_t done_cond;

    mutex_init(&done_mutex);
    cond_init(&done_cond);

    struct input_args in_args;
    in_args.url_queue = &url_queue;
    in_args.page_queue = &page_queue;
    in_args.url_set = &url_set;
    in_args.fetch = _fetch_fn;
    in_args.edge = _edge_fn;
    in_args.done_mutex = &done_mutex;
    in_args.done_cond = &done_cond;

    thread_t downloaders[download_workers];
    thread_t parsers[parse_workers];
    for (i = 0; i < download_workers; i++)
        thread_create(&downloaders[i], downloader, (void *)&in_args);
    for (i = 0; i < parse_workers; i++)
        thread_create(&parsers[i], parser, (void *)&in_args);

    while (1) {
        mutex_lock(&done_mutex);
        mutex_lock(&url_queue.mutex);
        mutex_lock(&url_queue.worker_mutex);
        mutex_lock(&page_queue.mutex);
        mutex_lock(&page_queue.worker_mutex);
        if (url_queue.count == 0 && url_queue.workers == 0 &&
            page_queue.count == 0 && page_queue.workers == 0) {
            url_queue.done = 1;
            page_queue.done = 1;
            cond_broadcast(&url_queue.empty);
            cond_broadcast(&url_queue.fill);
            cond_broadcast(&page_queue.fill);
            mutex_unlock(&url_queue.mutex);
            mutex_unlock(&url_queue.worker_mutex);
            mutex_unlock(&page_queue.mutex);
            mutex_unlock(&page_queue.worker_mutex);
            mutex_unlock(&done_mutex);
            break;
        } else {
            mutex_unlock(&url_queue.mutex);
            mutex_unlock(&url_queue.worker_mutex);
            mutex_unlock(&page_queue.mutex);
            mutex_unlock(&page_queue.worker_mutex);
            cond_wait(&done_cond, &done_mutex);
            mutex_unlock(&done_mutex);
        }
    }

    for (i = 0; i < download_workers; i++)
        thread_join(downloaders[i], NULL);
    for (i = 0; i < parse_workers; i++)
        thread_join(parsers[i], NULL);

    bounded_buffer_destroy(&url_queue);
    unbounded_buffer_destroy(&page_queue);
    hashset_destroy(&url_set);

    return 0;
}
예제 #15
0
파일: hashset.c 프로젝트: GNsunghokim/rtos
int hashset_testmain(int argc, const char *argv[]) {
	/* 0: Test Data/Result Initialization; Test Environment peekup */
	testlog = fopen("hashsettest_log.txt", "a");
	testresult = fopen("hashsettest_result.txt", "a");

	char *string0 = "tester0";
	char *string1 = "tester1";
	char *string2 = "tester2";
    	char *string3 = "tester3";
	char *string4 = "tester4";
	char *string5 = "tester5";
	char *string6 = "tester6";
	char *string7 = "tester7";
	char *string8 = "tester8";
	char *string9 = "tester9";

	/* 1: No Data Structure Memory Test */
	stage_log(1, "START");

	HashSet *set = hashset_create(DATATYPE_STRING, POOLTYPE_LOCAL, 10);

	if(set != NULL) stage_result(1, "create", true, set);
	else stage_result(1, "create", false, set);

	stage_log(1, "END");

	/* 2: No Node Memory Test */
	stage_log(2, "START");

	/* Test Data peekup */
	set = hashset_create(DATATYPE_STRING, POOLTYPE_LOCAL, 10);

	bool stage2_result = set->add(set, string0);
	if(stage2_result == true) stage_result(2, "get", true, set);
	else stage_result(2, "get", false, set);

	hashset_destroy(set);
	stage_log(2, "END");

	/* 3: Between Node Memory: NULL Data */
	stage_log(3, "START");

	/* Test Data peekup */
	set = hashset_create(DATATYPE_STRING, POOLTYPE_LOCAL, 10);

	/* Test Procedure */

	void* stage31_result = set->get(set, (void *)NULL);
	if(stage31_result != NULL) stage_result(3, "get", true, set);
	else stage_result(3, "get", false, set);

	bool stage32_result = set->add(set, (void *)NULL);
	if(stage32_result == true) stage_result(3, "add", true, set);
	else stage_result(3, "add", false, set);

	bool stage33_result = set->remove(set, (void*)NULL);
	if(stage33_result == true) stage_result(3, "remove", true, set);
	else stage_result(3, "remove", false, set);

	bool stage34_result = set->contains(set, (void *)NULL);
	if(stage34_result == true) stage_result(3, "contains", true, set);
	else stage_result(3, "contains", false, set);

	hashset_destroy(set);
	stage_log(3, "END");

	/* 4: Between Node Memory: No Duplicated Data */
	stage_log(4, "START");

	/* Test Data removeup */
	set = hashset_create(DATATYPE_STRING, POOLTYPE_LOCAL, 10);
	set->add(set, string0);
	set->add(set, string1);
	set->add(set, string2);
	set->add(set, string3);
	set->add(set, string4);

	/* Test Procedure */
	void* stage41_result = set->get(set, string5);
	if(stage41_result != NULL) stage_result(4, "get", true, set);
	else stage_result(4, "get", false, set);

	bool stage42_result = set->add(set, string5 );
	if(stage42_result == true) stage_result(4, "add", true, set);
	else stage_result(4, "add", false, set);

	bool stage43_result = set->remove(set, string5);
	if(stage43_result == true) stage_result(4, "remove", true, set);
	else stage_result(4, "remove", false, set);

	bool stage44_result = set->contains(set, string1);
	if(stage44_result == true) stage_result(4, "contains", true, set);
	else stage_result(4, "contains", false, set);

	/* abnormal case */
	void* stage45_result = set->get(set, string9);
	if(stage45_result != NULL) stage_result(4, "abnormal get", true, set);
	else stage_result(4, "abnormal get", false, set);

        bool stage46_result = set->remove(set, string8);
	if(stage46_result == true) stage_result(4, "abnormal remove", true, set);
	else stage_result(4, "abnormal remove", false, set);

	bool stage47_result = set->contains(set, string8);
	if(stage47_result == true) stage_result(4, "abnormal contains", true, set);
	else stage_result(4, "abnormal contains", false, set);

	hashset_destroy(set);
	stage_log(4, "END");

	/* 5: Between Node Memory: Duplicated Data */
	stage_log(5, "START");

	/* Test Data removeup */
	set = hashset_create(DATATYPE_STRING, POOLTYPE_LOCAL, 10);
	set->add(set, string0);
	set->add(set, string1);
	set->add(set, string2);
	set->add(set, string3);
	set->add(set, string4);

	/* Test Procedure */
	void* stage51_result = set->get(set, string0);
	if(stage51_result != NULL) stage_result(5, "get", true, set);
	else stage_result(5, "get", false, set);

	bool stage52_result = set->add(set, string1);
	if(stage52_result == true) stage_result(5, "add", true, set);
	else stage_result(5, "add", false, set);

	bool stage53_result = set->remove(set, string1);
	if(stage53_result == true) stage_result(5, "remove", true, set);
	else stage_result(5, "remove", false, set);

	bool stage54_result = set->contains(set, string1);
	if(stage54_result == true) stage_result(5, "contains", true, set);
	else stage_result(5, "contains", false, set);

	hashset_destroy(set);
	stage_log(5, "END");

	/* 6: Max Node Memory: NULL Data */
	stage_log(6, "START");

	/* Test Data removeup */
	set = hashset_create(DATATYPE_STRING, POOLTYPE_LOCAL, 10);
	set->add(set, string0);
	set->add(set, string1);
	set->add(set, string2);
	set->add(set, string3);
	set->add(set, string4);
	set->add(set, string5);
	set->add(set, string6);
	set->add(set, string7);
	set->add(set, string8);
	set->add(set, string9);

	/* Test Procedure */

	void* stage61_result = set->get(set, (void *)NULL);
	if(stage61_result != NULL) stage_result(6, "get", true, set);
	else stage_result(6, "get", false, set);

	bool stage62_result = set->add(set, (void *)NULL);
	if(stage62_result == true) stage_result(6, "add", true, set);
	else stage_result(6, "add", false, set);

	bool stage63_result = set->remove(set, (void *)NULL);
	if(stage63_result == true) stage_result(6, "remove", true, set);
	else stage_result(6, "remove", false, set);

	bool stage64_result = set->contains(set, (void *)NULL);
	if(stage64_result == true) stage_result(6, "contains", true, set);
	else stage_result(6, "contains", false, set);

	hashset_destroy(set);
	stage_log(6, "END");

	/* 7: Max Node Memory: No Duplicated Data */
	stage_log(7, "START");

	/* Test Data removeup */
	set = hashset_create(DATATYPE_STRING, POOLTYPE_LOCAL, 10);
	set->add(set, string0);
	set->add(set, string1);
	set->add(set, string2);
	set->add(set, string3);
	set->add(set, string4);
	set->add(set, string5);
	set->add(set, string6);
	set->add(set, string7);
	set->add(set, string8);
	set->add(set, string9);

	/* Test Procedure */
	void* stage71_result = set->get(set, string1);
	if(stage71_result != NULL) stage_result(7, "get", true, set);
	else stage_result(7, "get", false, set);

	bool stage72_result = set->add(set, string1);
	if(stage72_result == true) stage_result(7, "add", true, set);
	else stage_result(7, "add", false, set);

	bool stage73_result = set->remove(set, string1);
	if(stage73_result == true) stage_result(7, "remove", true, set);
	else stage_result(7, "remove", false, set);

	bool stage74_result = set->contains(set, string1);
	if(stage74_result == true) stage_result(7, "contains", true, set);
	else stage_result(7, "contains", false, set);

	hashset_destroy(set);
	stage_log(7, "END");

	/* 8: Max Node Memory: Duplicated Data */
	stage_log(8, "START");

	/* Test Data removeup */
	set = hashset_create(DATATYPE_STRING, POOLTYPE_LOCAL, 10);
	set->add(set, string0);
	set->add(set, string1);
	set->add(set, string2);
	set->add(set, string3);
	set->add(set, string4);
	set->add(set, string0);
	set->add(set, string1);
	set->add(set, string2);
	set->add(set, string3);
	set->add(set, string4);

	/* Test Procedure */
	void* stage81_result = set->get(set, string1);
	if(stage81_result != NULL) stage_result(8, "get", true, set);
	else stage_result(8, "get", false, set);

	bool stage82_result = set->add(set, string1);
	if(stage82_result == true) stage_result(8, "add", true, set);
	else stage_result(8, "add", false, set);

	bool stage83_result = set->remove(set, string1);
	if(stage83_result == true) stage_result(8, "remove", true, set);
	else stage_result(8, "remove", false, set);

	bool stage84_result = set->contains(set, string1);
	if(stage84_result == true) stage_result(8, "contains", true, set);
	else stage_result(8, "contains", false, set);

	hashset_destroy(set);
	stage_log(8, "END");

	/* 9: Test Result Store */
	fclose(testlog);
	fclose(testresult);

	return 0;
}
예제 #16
0
파일: hstr_regexp.c 프로젝트: atdt/hstr
void hstr_regexp_destroy(HstrRegexp *hstrRegexp)
{
	hashset_destroy(&hstrRegexp->cache, true);
}
예제 #17
0
LIBCOUCHBASE_API
void lcb_destroy(lcb_t instance)
{
    lcb_size_t ii;
    lcb_settings *settings = &instance->settings;

    if (instance->cur_configinfo) {
        lcb_clconfig_decref(instance->cur_configinfo);
        instance->cur_configinfo = NULL;
    }
    instance->vbucket_config = NULL;

    lcb_bootstrap_destroy(instance);
    lcb_confmon_destroy(instance->confmon);
    hostlist_destroy(instance->usernodes);

    if (instance->timers != NULL) {
        for (ii = 0; ii < instance->timers->capacity; ++ii) {
            if (instance->timers->items[ii] > 1) {
                lcb_timer_destroy(instance,
                                  (lcb_timer_t)instance->timers->items[ii]);
            }
        }
        hashset_destroy(instance->timers);
    }

    if (instance->durability_polls) {
        struct lcb_durability_set_st **dset_list;
        lcb_size_t nitems = hashset_num_items(instance->durability_polls);
        dset_list = (struct lcb_durability_set_st **)
                    hashset_get_items(instance->durability_polls, NULL);
        if (dset_list) {
            for (ii = 0; ii < nitems; ii++) {
                lcb_durability_dset_destroy(dset_list[ii]);
            }
            free(dset_list);
        }
        hashset_destroy(instance->durability_polls);
    }

    for (ii = 0; ii < instance->nservers; ++ii) {
        lcb_server_destroy(instance->servers + ii);
    }

    if (instance->http_requests) {
        for (ii = 0; ii < instance->http_requests->capacity; ++ii) {
            if (instance->http_requests->items[ii] > 1) {
                lcb_http_request_t htreq =
                    (lcb_http_request_t)instance->http_requests->items[ii];

                /**
                 * We don't want to invoke callbacks *or* remove it from our
                 * hash table
                 */
                htreq->status |= LCB_HTREQ_S_CBINVOKED | LCB_HTREQ_S_HTREMOVED;

                /* we should figure out a better error code for this.. */
                lcb_http_request_finish(instance, htreq, LCB_ERROR);
            }
        }
    }

    hashset_destroy(instance->http_requests);

    free(instance->servers);

    connmgr_destroy(instance->memd_sockpool);

    if (settings->io && settings->io->v.v0.need_cleanup) {
        lcb_destroy_io_ops(settings->io);
    }

    ringbuffer_destruct(&instance->purged_buf);
    ringbuffer_destruct(&instance->purged_cookies);

    free(instance->histogram);
    free(instance->scratch);
    free(settings->username);
    free(settings->password);
    free(settings->bucket);
    free(settings->sasl_mech_force);
    if (instance->cmdht) {
        genhash_free(instance->cmdht);
        instance->cmdht = NULL;
    }

    memset(instance, 0xff, sizeof(*instance));
    free(instance);
}
double genHOMFitness(char* srcDir,char*target,char*makeDir,Config *user_config,char*original_source,MResult *mResult,HOMutant *hom){

	char **args_combineFOM = malloc(sizeof(char*)*(hom->FOMutants_count+4));
	args_combineFOM[0]="bash";
	args_combineFOM[1]="combineFOM.sh";
	args_combineFOM[2]=original_source;
	args_combineFOM[hom->FOMutants_count+2]=NULL;

	//Merge all the FOM source files to generate the HOM
	int i;
	for (i=0;i<hom->FOMutants_count;i++){
		args_combineFOM[i+3]=hom->FOMutants[i].mutant_source_file;
	}
	startprogram(args_combineFOM,NULL,0);
	free(args_combineFOM);

	char hom_dir[strlen(srcDir)+strlen("hom_dir.log")+2];
	sprintf(hom_dir,"%s/%s", srcDir, "hom_dir.log");

	char hom_dir_loc[strlen(srcDir)+20];
	char hom_file_name[strlen(srcDir)+20];

	FILE* hom_dir_file =fopen(hom_dir,"r");
	if(hom_dir_file==NULL){
		return -1;
	}
	fscanf (hom_dir_file, "%s %s",hom_file_name , hom_dir_loc);
	fclose(hom_dir_file);

	copy_file(hom_dir_loc, target);

	//Evaluate mutant
	//Run make on the mutated project in order to build it
	printf("--> Evaluating HOM: %s\n",hom_file_name);

	//Open log file for recording mutation results
	mutation_results = fopen(mutation_results_path,"a+");
	fprintf(mutation_results, "\n**** Mutant: %s ****\n",hom_file_name);
	fflush(mutation_results);
	fclose(mutation_results);
	mResult->homResult->total_mutants++;

	//Get mutants killed by tests before new evaluation
	int prev_killed_by_tests=get_non_trivial_FOM_stats()[0];

	if(runMake(makeDir,hom_file_name,user_config->makeTestTarget)==2){
		mResult->homResult->mutant_kill_count++;
	}

	//Get mutants killed by tests after evaluation
	int *stats = get_non_trivial_FOM_stats();

	if(stats[0]-prev_killed_by_tests==1){
		mResult->homResult->mutant_kill_count++;
	}
	hom->fragility=((double)stats[1]/(double)stats[2]);

	//Generate the fragility for all the set of FOMs that makeup this HOM
	hashset_t test_killed_set = hashset_create();
	if (test_killed_set == NULL) {
		fprintf(stderr, "failed to create hashset instance\n");
		abort();
	}

	int mut,c;
	for(mut=0;mut<hom->FOMutants_count;mut++){
		Mutant mutant = hom->FOMutants[mut];
		for(c=0;c<mutant.killed_by_tests_count;c++){
			hashset_add(test_killed_set, &mutant.killed_by_tests[c]);
		}
	}
	hom->fitness=hom->fragility/(((double)hashset_num_items(test_killed_set)/(double)stats[2]));
	hashset_destroy(test_killed_set);
	return hom->fitness;
}