Exemple #1
0
void handle_signals_resets_terminal(void)
{
	int status, masterfd;
	char* slavedevice = NULL;
	struct termios test_flags;
	pid_t child_pid;

	masterfd = posix_openpt(O_RDWR|O_NOCTTY);

	if (masterfd == -1
		|| grantpt (masterfd) == -1
		|| unlockpt (masterfd) == -1
		|| (slavedevice = ptsname (masterfd)) == NULL)
		CU_FAIL_FATAL("Could not create pty");

	terminal_fildes = open(slavedevice, O_RDWR|O_NOCTTY);
	tcgetattr(terminal_fildes, &orig_flags);
	new_flags = orig_flags;
	new_flags.c_lflag &= ~ECHO;
	tcsetattr(terminal_fildes, TCSANOW, &new_flags);
	terminal_needs_reset = 1;

	if((child_pid = fork()) == 0)
	{
		freerdp_handle_signals();
		raise(SIGINT);
	}
	while(wait(&status) != -1);
	tcgetattr(terminal_fildes, &test_flags);
	CU_ASSERT_EQUAL(orig_flags.c_lflag, test_flags.c_lflag);
	close(masterfd);
	close(terminal_fildes);
}
/**
 * \brief Test pkgagent.c ProcessUpload function
 * give the upload_pk of debian binary package,
 * get the package information about this upload id
 */
void test_ProcessUpload()
{
    struct debpkginfo *pi;
    long upload_pk;
    char *ErrorBuf;

    int predictValue = 0;
    pi = (struct debpkginfo *)malloc(sizeof(struct debpkginfo));

    /* perpare testing data in database */
    db_conn = fo_dbconnect(DBConfFile, &ErrorBuf);

    upload_pk = prepare_Database(db_conn, pi);
    if (upload_pk == -1)
        CU_FAIL_FATAL("Prepare database data ERROR!");

    if (prepare_Repository() == -1)
    {
        remove_Database(db_conn, pi, upload_pk);
        CU_FAIL_FATAL("Prepare repository data ERROR!");
    }

    /* Test ProcessUpload function */
    int Result = ProcessUpload(upload_pk);
    printf("ProcessUpload Result is:%d\n", Result);

    CU_ASSERT_EQUAL(Result, predictValue);

    /* Clear testing data in database */
    if (remove_Database(db_conn, pi, upload_pk) == -1)
        CU_FAIL_FATAL("Remove database data ERROR!");
    if (remove_Repository() == -1)
        CU_FAIL_FATAL("Remove repository data ERROR!");

    PQfinish(db_conn);
    memset(pi, 0, sizeof(struct debpkginfo));
    free(pi);
}
Exemple #3
0
void passphrase_read_prompts_to_tty()
{
	static const int read_nbyte = 11;
	int masterfd;
	char* slavedevice = NULL;
	char read_buf[read_nbyte];
	fd_set fd_set_write;

	masterfd = posix_openpt(O_RDWR|O_NOCTTY);

	if (masterfd == -1
		|| grantpt (masterfd) == -1
		|| unlockpt (masterfd) == -1
		|| (slavedevice = ptsname (masterfd)) == NULL)
		CU_FAIL_FATAL("Could not create pty");

	switch (fork())
	{
	case -1:
		CU_FAIL_FATAL("Could not fork");
	case 0:
		{
			static const int password_size = 512;
			char buffer[password_size];
			int slavefd;
			if (setsid() == (pid_t) -1)
				CU_FAIL_FATAL("Could not create new session");

			if ((slavefd = open(slavedevice, O_RDWR)) == 0)
				CU_FAIL_FATAL("Could not open slave end of pty");
			close(STDIN_FILENO);
			close(STDOUT_FILENO);
			close(STDERR_FILENO);
			close(masterfd);
			freerdp_passphrase_read("Password: "******"Master end of pty not writeable");
	if (read(masterfd, read_buf, read_nbyte) == (ssize_t) -1)
		CU_FAIL_FATAL("Nothing written to slave end of pty");
	CU_ASSERT_STRING_EQUAL(read_buf, "Password: "******"\n", (size_t) 2);
	close(masterfd);
	return;
}
Exemple #4
0
int main (int argc, char *argv []) {
	CK_SLOT_ID slotlist [2];
	CK_ULONG slotcount = 2;
	CU_pSuite st [4];
	int opt;
	int todo;
	extern char *optarg;

	/*
	 * Test arguments.
	 */
	todo = 1;
	while (todo && (opt = getopt_long (argc, argv, opts, longopts, NULL))) {
		switch (opt) {
		case 'p':	// --pin
			storepin ("user", optarg, ascii_pin_user, sizeof (ascii_pin_user) - 1);
			break;
			
		case 'P':	// --so-pin
			storepin ("SO", optarg, ascii_pin_so, sizeof (ascii_pin_so) - 1);
			break;
		case 'l':	// --pkcs1llib
			if (p11) {
				fprintf (stderr, "You should not open multiple PKCS #11 libraries\n");
				exit (1);
			}
			p11 = dlopen (optarg, RTLD_NOW | RTLD_GLOBAL);
			if (!p11) {
				fprintf (stderr, "%s\n", dlerror ());
				exit (1);
			}
			break;
		case 'X':	// --destructive
			if (destructive) {
				fprintf (stderr, "You should not specify your destructive wishes more than once\n");
				exit (1);
			}
			destructive = 1;
			break;
		case 'f':	// --fast-and-frivolous
			if (thousands < 1000) {
				fprintf (stderr, "You should not specify the fast option more than once\n");
				exit (1);
			}
			thousands = 10;
			hundred = 8;
			couple = 3;
			break;
		case 'v':		// --verbose
			if (optarg) {
				verbosity = atoi (optarg);
				if (verbosity < 0) {
					fprintf (stderr, "You should not specify negative verbosity levels\n");
					exit (1);
				}
			} else {
				verbosity++;
			}
			break;
		case 1:			// --test-initiation
			if (skip_initiation == 0) {
				fprintf (stderr, "You should not specify --test-initiation more than once\n");
				exit (1);
			}
			skip_initiation = 0;
			break;
		case 2:			// --skip-fragmentation
			if (skip_fragmentation) {
				fprintf (stderr, "You should not specify --skip-fragmentation more than once\n");
				exit (1);
			}
			skip_fragmentation = 1;
			break;
		case 3:			// --skip-keysizing
			if (skip_keysizing) {
				fprintf (stderr, "You should not specify --skip-keysizing more than once\n");
				exit (1);
			}
			skip_keysizing = 1;
			break;
		case 4:			// --skip-signing
			if (skip_signing) {
				fprintf (stderr, "You should not specify --skip-signing more than once\n");
				exit (1);
			}
			skip_signing = 1;
			break;
		// case 't':
		// Token?
		case -1:		// Done -- but are we, really?
			if ((*ascii_pin_user) && (*ascii_pin_so) && p11) {
				todo = 0;
				break;
			}
			// else continue...
			fprintf (stderr, "Please set all values required.\n");
		case 'h':
		case ':':
		case '?':
			fprintf (stderr, "Minimal usage: %s --pin 1234 --so-pin 4321 --pkcs11lib /path/to/libpkcs11.so\n", argv [0]);
			exit (opt != 'h');
		}
	}

	/*
 	 * Register test suites and tests.
	 */
	if (CU_initialize_registry () != CUE_SUCCESS) {
		fprintf (stderr, "Failed to initialise test registry -- this is abnormal\n");
		exit (1);
	} else {
		cu_open = 1;
	}
	st [0] = CU_add_suite ("Test if slot initiation works properly", NULL, NULL);
	st [1] = CU_add_suite ("Test if memory does not get fragmented", NULL, NULL);
	st [2] = CU_add_suite ("Test if key sizes work as desired", NULL, NULL);
	st [3] = CU_add_suite ("Test if signatures are made correctly", NULL, NULL);
	if (! (st [0] && st [1] && st [2] && st [3])) {
		fprintf (stderr, "Failed to allocate all test suites -- this is abnormal\n");
		exit (1);
	}
	if (! skip_initiation) {
		if (! CU_add_test (st [0], "Initiation test", testslot_initiation)) {
			fprintf (stderr, "Failed to register test #0 -- this is abnormal\n");
			exit (1);
		}
	}
	if (! skip_fragmentation) {
		if (! CU_add_test (st [1], "Fragmentation test", testslot_fragmentation)) {
			fprintf (stderr, "Failed to register test #1 -- this is abnormal\n");
			exit (1);
		}
	}
	if (! skip_keysizing) {
		if (! CU_add_test (st [2], "Key sizing test", testslot_keysizing)) {
			fprintf (stderr, "Failed to register test #2 -- this is abnormal\n");
			exit (1);
		}
	}
	if (! skip_signing) {
		if (! CU_add_test (st [3], "Signing test", testslot_signing)) {
			fprintf (stderr, "Failed to register test #3 -- this is abnormal\n");
			exit (1);
		}
	}

	/*
	 * Initialise the library and demand only one slot with a token.
	 */
	TESTRV ("Initialising PKCS #11 library",
		 P11("C_Initialize") (NULL_PTR));
	MKFATAL ();
	atexit (bailout);
	TESTRV ("Obtaining list of slots",
		 P11("C_GetSlotList") (TRUE, slotlist, &slotcount));
	if (slotcount != 1) {
		fprintf (stderr, "Number of slots is %d, so not equal to 1 -- unsure which to test\n", (int) slotcount);
		exit (1);
	}
	slotid = slotlist [0];

	/*
	 * Obtain mechanism information from the token.
 	 */
	TESTRV ("Getting number of mechanisms from token",
		 P11("C_GetMechanismInfo") (slotid, CKM_RSA_PKCS_KEY_PAIR_GEN, &mech_rsa_pkcs_key_pair_gen));
	MKFATAL ();
	TESTRV ("Getting number of mechanisms from token",
		 P11("C_GetMechanismInfo") (slotid, CKM_RSA_PKCS, &mech_rsa_pkcs));
	MKFATAL ();
	/*
	TESTRV ("Getting number of mechanisms from token",
		 P11("C_GetMechanismInfo") (slotid, CKM_SHA_1, &mech_sha_1));
	MKFATAL ();
	*/

	/*
	 * Format the token and run a test.
	 * Do we need an "are you sure?" warning here?
	 */
	if (strlen (TOKENLABEL_32CHARS) != 32) {
		CU_FAIL_FATAL ("Token labels must be 32 characters long -- fix TOKENLABEL_32CHARS and recompile");
	}

	/*
	 * Automatically run all the tests that were registered
	 */
	if (verbosity >= 1) {
		printf ("Beginning test sequence\n");
	}
	CU_list_tests_to_file ();
	CU_automated_run_tests ();
	if (verbosity >= 1) {
		printf ("Ended test sequence\n");
	}

	/*
	 * Unload the PKCS #11 library
	 */
	if (p11) {
		dlclose (p11);
		p11 = NULL;
	}

	/*
	 * Terminate without error-reporting return value.
	 */
	if (cu_open) {
		CU_cleanup_registry ();
		cu_open = 0;
	}
	exit (0);
}
Exemple #5
0
static int schedule_common_(void *arg)
{
	thread_args_t *args = (thread_args_t *)arg;
	odp_schedule_sync_t sync;
	test_globals_t *globals;
	queue_context *qctx;
	buf_contents *bctx, *bctx_cpy;
	odp_pool_t pool;
	int locked;
	int num;
	odp_event_t ev;
	odp_buffer_t buf, buf_cpy;
	odp_queue_t from;

	globals = args->globals;
	sync = args->sync;

	pool = odp_pool_lookup(MSG_POOL_NAME);
	CU_ASSERT_FATAL(pool != ODP_POOL_INVALID);

	if (args->num_workers > 1)
		odp_barrier_wait(&globals->barrier);

	while (1) {
		from = ODP_QUEUE_INVALID;
		num = 0;

		odp_ticketlock_lock(&globals->lock);
		if (globals->buf_count == 0) {
			odp_ticketlock_unlock(&globals->lock);
			break;
		}
		odp_ticketlock_unlock(&globals->lock);

		if (args->enable_schd_multi) {
			odp_event_t events[BURST_BUF_SIZE],
				ev_cpy[BURST_BUF_SIZE];
			odp_buffer_t buf_cpy[BURST_BUF_SIZE];
			int j;

			num = odp_schedule_multi(&from, ODP_SCHED_NO_WAIT,
						 events, BURST_BUF_SIZE);
			CU_ASSERT(num >= 0);
			CU_ASSERT(num <= BURST_BUF_SIZE);
			if (num == 0)
				continue;

			if (sync == ODP_SCHED_SYNC_ORDERED) {
				int ndx;
				int ndx_max;
				int rc;

				ndx_max = odp_queue_lock_count(from);
				CU_ASSERT_FATAL(ndx_max >= 0);

				qctx = odp_queue_context(from);

				for (j = 0; j < num; j++) {
					bctx = odp_buffer_addr(
						odp_buffer_from_event
						(events[j]));

					buf_cpy[j] = odp_buffer_alloc(pool);
					CU_ASSERT_FATAL(buf_cpy[j] !=
							ODP_BUFFER_INVALID);
					bctx_cpy = odp_buffer_addr(buf_cpy[j]);
					memcpy(bctx_cpy, bctx,
					       sizeof(buf_contents));
					bctx_cpy->output_sequence =
						bctx_cpy->sequence;
					ev_cpy[j] =
						odp_buffer_to_event(buf_cpy[j]);
				}

				rc = odp_queue_enq_multi(qctx->pq_handle,
							 ev_cpy, num);
				CU_ASSERT(rc == num);

				bctx = odp_buffer_addr(
					odp_buffer_from_event(events[0]));
				for (ndx = 0; ndx < ndx_max; ndx++) {
					odp_schedule_order_lock(ndx);
					CU_ASSERT(bctx->sequence ==
						  qctx->lock_sequence[ndx]);
					qctx->lock_sequence[ndx] += num;
					odp_schedule_order_unlock(ndx);
				}
			}

			for (j = 0; j < num; j++)
				odp_event_free(events[j]);
		} else {
			ev  = odp_schedule(&from, ODP_SCHED_NO_WAIT);
			if (ev == ODP_EVENT_INVALID)
				continue;

			buf = odp_buffer_from_event(ev);
			num = 1;
			if (sync == ODP_SCHED_SYNC_ORDERED) {
				int ndx;
				int ndx_max;
				int rc;

				ndx_max = odp_queue_lock_count(from);
				CU_ASSERT_FATAL(ndx_max >= 0);

				qctx = odp_queue_context(from);
				bctx = odp_buffer_addr(buf);
				buf_cpy = odp_buffer_alloc(pool);
				CU_ASSERT_FATAL(buf_cpy != ODP_BUFFER_INVALID);
				bctx_cpy = odp_buffer_addr(buf_cpy);
				memcpy(bctx_cpy, bctx, sizeof(buf_contents));
				bctx_cpy->output_sequence = bctx_cpy->sequence;

				rc = odp_queue_enq(qctx->pq_handle,
						   odp_buffer_to_event
						   (buf_cpy));
				CU_ASSERT(rc == 0);

				for (ndx = 0; ndx < ndx_max; ndx++) {
					odp_schedule_order_lock(ndx);
					CU_ASSERT(bctx->sequence ==
						  qctx->lock_sequence[ndx]);
					qctx->lock_sequence[ndx] += num;
					odp_schedule_order_unlock(ndx);
				}
			}

			odp_buffer_free(buf);
		}

		if (args->enable_excl_atomic) {
			locked = odp_spinlock_trylock(&globals->atomic_lock);
			CU_ASSERT(locked != 0);
			CU_ASSERT(from != ODP_QUEUE_INVALID);
			if (locked) {
				int cnt;
				odp_time_t time = ODP_TIME_NULL;
				/* Do some work here to keep the thread busy */
				for (cnt = 0; cnt < 1000; cnt++)
					time = odp_time_sum(time,
							    odp_time_local());

				odp_spinlock_unlock(&globals->atomic_lock);
			}
		}

		if (sync == ODP_SCHED_SYNC_ATOMIC)
			odp_schedule_release_atomic();

		if (sync == ODP_SCHED_SYNC_ORDERED)
			odp_schedule_release_ordered();

		odp_ticketlock_lock(&globals->lock);

		globals->buf_count -= num;

		if (globals->buf_count < 0) {
			odp_ticketlock_unlock(&globals->lock);
			CU_FAIL_FATAL("Buffer counting failed");
		}

		odp_ticketlock_unlock(&globals->lock);
	}

	if (args->num_workers > 1)
		odp_barrier_wait(&globals->barrier);

	if (sync == ODP_SCHED_SYNC_ORDERED)
		locked = odp_ticketlock_trylock(&globals->lock);
	else
		locked = 0;

	if (locked && globals->buf_count_cpy > 0) {
		odp_event_t ev;
		odp_queue_t pq;
		uint64_t seq;
		uint64_t bcount = 0;
		int i, j;
		char name[32];
		uint64_t num_bufs = args->num_bufs;
		uint64_t buf_count = globals->buf_count_cpy;

		for (i = 0; i < args->num_prio; i++) {
			for (j = 0; j < args->num_queues; j++) {
				snprintf(name, sizeof(name),
					 "plain_%d_%d_o", i, j);
				pq = odp_queue_lookup(name);
				CU_ASSERT_FATAL(pq != ODP_QUEUE_INVALID);

				seq = 0;
				while (1) {
					ev = odp_queue_deq(pq);

					if (ev == ODP_EVENT_INVALID) {
						CU_ASSERT(seq == num_bufs);
						break;
					}

					bctx = odp_buffer_addr(
						odp_buffer_from_event(ev));

					CU_ASSERT(bctx->sequence == seq);
					seq++;
					bcount++;
					odp_event_free(ev);
				}
			}
		}
		CU_ASSERT(bcount == buf_count);
		globals->buf_count_cpy = 0;
	}

	if (locked)
		odp_ticketlock_unlock(&globals->lock);

	/* Clear scheduler atomic / ordered context between tests */
	num = exit_schedule_loop();

	CU_ASSERT(num == 0);

	if (num)
		printf("\nDROPPED %i events\n\n", num);

	return 0;
}
Exemple #6
0
void passphrase_read_turns_on_newline_echo_during_read()
{
	static const int read_nbyte = 11;
	int masterfd, slavefd;
	char* slavedevice = NULL;
	char read_buf[read_nbyte];
	fd_set fd_set_write;
	struct termios term_flags;

	masterfd = posix_openpt(O_RDWR|O_NOCTTY);

	if (masterfd == -1
		|| grantpt (masterfd) == -1
		|| unlockpt (masterfd) == -1
		|| (slavedevice = ptsname (masterfd)) == NULL)
		CU_FAIL_FATAL("Could not create pty");

	slavefd = open(slavedevice, O_RDWR|O_NOCTTY);
	if (slavefd == -1)
		CU_FAIL_FATAL("Could not open slave end of pty");

	if (tcgetattr(slavefd, &term_flags) != 0)
		CU_FAIL_FATAL("Could not get slave pty attributes");
	if (term_flags.c_lflag & ECHONL)
	{
		term_flags.c_lflag &= ~ECHONL;
		if (tcsetattr(slavefd, TCSANOW, &term_flags) != 0)
			CU_FAIL_FATAL("Could not turn ECHO on on slave pty");
	}

	switch (fork())
	{
	case -1:
		CU_FAIL_FATAL("Could not fork");
	case 0:
		{
			static const int password_size = 512;
			int child_slavefd;
			char buffer[password_size];
			if (setsid() == (pid_t) -1)
				CU_FAIL_FATAL("Could not create new session");

			if ((child_slavefd = open(slavedevice, O_RDWR)) == 0)
				CU_FAIL_FATAL("Could not open slave end of pty");
			close(STDIN_FILENO);
			close(STDOUT_FILENO);
			close(STDERR_FILENO);
			close(masterfd);
			close(slavefd);
			freerdp_passphrase_read("Password: "******"Master end of pty not writeable");
	if (read(masterfd, read_buf, read_nbyte) == (ssize_t) -1)
		CU_FAIL_FATAL("Nothing written to slave end of pty");

	if (tcgetattr(slavefd, &term_flags) != 0)
		CU_FAIL_FATAL("Could not get slave pty attributes");
	CU_ASSERT(term_flags.c_lflag & ECHONL)
	write(masterfd, "\n", (size_t) 2);
	close(masterfd);
	close(slavefd);
	return;
}
Exemple #7
0
void timer_test_odp_timer_cancel(void)
{
	odp_pool_t pool;
	odp_pool_param_t params;
	odp_timer_pool_param_t tparam;
	odp_timer_pool_t tp;
	odp_queue_t queue;
	odp_timer_t tim;
	odp_event_t ev;
	odp_timeout_t tmo;
	odp_timer_set_t rc;
	uint64_t tick;

	odp_pool_param_init(&params);
	params.type    = ODP_POOL_TIMEOUT;
	params.tmo.num = 1;

	pool = odp_pool_create("tmo_pool_for_cancel", &params);

	if (pool == ODP_POOL_INVALID)
		CU_FAIL_FATAL("Timeout pool create failed");

	tparam.res_ns     = 100 * ODP_TIME_MSEC_IN_NS;
	tparam.min_tmo    = 1   * ODP_TIME_SEC_IN_NS;
	tparam.max_tmo    = 10  * ODP_TIME_SEC_IN_NS;
	tparam.num_timers = 1;
	tparam.priv       = 0;
	tparam.clk_src    = ODP_CLOCK_CPU;
	tp = odp_timer_pool_create("timer_pool0", &tparam);
	if (tp == ODP_TIMER_POOL_INVALID)
		CU_FAIL_FATAL("Timer pool create failed");

	/* Start all created timer pools */
	odp_timer_pool_start();

	queue = odp_queue_create("timer_queue", NULL);
	if (queue == ODP_QUEUE_INVALID)
		CU_FAIL_FATAL("Queue create failed");

	#define USER_PTR ((void *)0xdead)
	tim = odp_timer_alloc(tp, queue, USER_PTR);
	if (tim == ODP_TIMER_INVALID)
		CU_FAIL_FATAL("Failed to allocate timer");
	LOG_DBG("Timer handle: %" PRIu64 "\n", odp_timer_to_u64(tim));

	ev = odp_timeout_to_event(odp_timeout_alloc(pool));
	if (ev == ODP_EVENT_INVALID)
		CU_FAIL_FATAL("Failed to allocate timeout");

	tick = odp_timer_ns_to_tick(tp, 2 * ODP_TIME_SEC_IN_NS);

	rc = odp_timer_set_rel(tim, tick, &ev);
	if (rc != ODP_TIMER_SUCCESS)
		CU_FAIL_FATAL("Failed to set timer (relative time)");

	ev = ODP_EVENT_INVALID;
	if (odp_timer_cancel(tim, &ev) != 0)
		CU_FAIL_FATAL("Failed to cancel timer (relative time)");

	if (ev == ODP_EVENT_INVALID)
		CU_FAIL_FATAL("Cancel did not return event");

	tmo = odp_timeout_from_event(ev);
	if (tmo == ODP_TIMEOUT_INVALID)
		CU_FAIL_FATAL("Cancel did not return timeout");
	LOG_DBG("Timeout handle: %" PRIu64 "\n", odp_timeout_to_u64(tmo));

	if (odp_timeout_timer(tmo) != tim)
		CU_FAIL("Cancel invalid tmo.timer");

	if (odp_timeout_user_ptr(tmo) != USER_PTR)
		CU_FAIL("Cancel invalid tmo.user_ptr");

	odp_timeout_free(tmo);

	ev = odp_timer_free(tim);
	if (ev != ODP_EVENT_INVALID)
		CU_FAIL_FATAL("Free returned event");

	odp_timer_pool_destroy(tp);

	if (odp_queue_destroy(queue) != 0)
		CU_FAIL_FATAL("Failed to destroy queue");

	if (odp_pool_destroy(pool) != 0)
		CU_FAIL_FATAL("Failed to destroy pool");
}
Exemple #8
0
void create_temp_file(const char *from)
{
  remove(TEMPFILE);
  if(copy(from, TEMPFILE) == NULL)
    CU_FAIL_FATAL("Could not create temp file.");
}
Exemple #9
0
void test_rf_set_new_powerset() {
CU_FAIL_FATAL("not implemented");
	char a[] = "a";
	char b[] = "b";
	char c[] = "c";

	char *results[] = {
		"   ",
		"   ",
		"   ",
		"   ",
		"   ",
		"   ",
		"   ",
		'\0'
	};
	char *expected[] = {
		"a", "b", "c", "ab", "ac", "bc", "abc", '\0'
	};

	rf_SetElement *elems[] = {
		rf_set_element_new_string(a),
		rf_set_element_new_string(b),
		rf_set_element_new_string(c),
	};

	rf_Set *set1 = rf_set_new(3, elems);
	CU_ASSERT_TRUE(set1 != NULL);

	rf_Set *powerset = rf_set_new_powerset(set1);
	CU_ASSERT_EQUAL(powerset->cardinality, 8);

/*
	for(int i = 0; i < 8; i++) {
		for(int j = 0; j < 3; j++) {
			results[i][j] = 0;
		}
	}
*/

	for(int i = 0; i < powerset->cardinality; i++) {
		rf_SetElement *tmp1 = powerset->elements[i];
		for(int j = 0; j < tmp1->value.set->cardinality; j++) {
			rf_SetElement *tmp2 = tmp1->value.set->elements[j];
			if(tmp2 != NULL) {
				results[i][j] = *tmp2->value.string;
			}
		}
//		printf("### ^%s$\n", results[i]);
	}

	for(int i = 0; i < 8; i++) {
		bool contains = false;
		for(int j = 0; j < 3; j++) {
			if(strcmp(results[i], expected[j]) == 0) {
				printf("[%s|%s]\n", results[i], expected[i]);
				contains = true;
			}
		}
		CU_ASSERT_TRUE(contains);
	}

	rf_set_free(set1);
	rf_set_free(powerset);
}