void try_checked_pop(struct pico_mqtt_list* list, uint32_t index, uint32_t length_after)
{
	uint32_t length = 0;
	struct pico_mqtt_message* message = NULL;

	try_length(pico_mqtt_list_length(list, &length));
	ck_assert_msg( length == length_after+1, "The length is not changed correctly\n");

	try_pop(pico_mqtt_list_pop(list, &message));
	ck_assert_msg( message->message_id == index, "Failed to pop the top of the message\n");

	try_length(pico_mqtt_list_length(list, &length));
	ck_assert_msg( length == length_after, "The length is not changed correctly\n");
}
void try_checked_push(struct pico_mqtt_list* list, uint32_t index, uint32_t length_after)
{
	uint32_t length = 0;

	try_length(pico_mqtt_list_length(list, &length));
	ck_assert_msg( length == length_after-1, "Failed to get the length of the list\n");

	try_push(pico_mqtt_list_push(list, &test_messages[index]));

	try_length(pico_mqtt_list_length(list, &length));
	ck_assert_msg( length == length_after, "The length is not changed correctly\n");

	try_length(pico_mqtt_list_length(list, &length));
	ck_assert_msg( length == length_after, "The length should not have changed\n");
}
END_TEST

START_TEST(push_peek_length_and_pop_test)
{
	struct pico_mqtt_list* list;
	struct pico_mqtt_message* message;
	int result = 0;
	uint32_t length = 0;

	result = pico_mqtt_list_create(&list);
	ck_assert_msg( result == SUCCES, "Failed to create the list\n");

	try_length(pico_mqtt_list_length(list, &length));
	ck_assert_msg( length == 0, "Failed to get the length of the list\n");

	try_push(pico_mqtt_list_push(list, &test_messages[0]));

	try_length(pico_mqtt_list_length(list, &length));
	ck_assert_msg( length == 1, "The length is not changed correctly\n");

	try_peek(pico_mqtt_list_peek(list, &message));
	ck_assert_msg( message->message_id == 0, "Failed to peek at the top of the message\n");
	message = NULL;

	try_length(pico_mqtt_list_length(list, &length));
	ck_assert_msg( length == 1, "The length should not have changed\n");

	try_pop(pico_mqtt_list_pop(list, &message));
	ck_assert_msg( message->message_id == 0, "Failed to pop the top of the message\n");

	try_length(pico_mqtt_list_length(list, &length));
	ck_assert_msg( length == 0, "The length is not changed correctly\n");

	result = pico_mqtt_list_destroy(&list);
	ck_assert_msg( result == SUCCES, "Failed to destory the list\n");

}
	bool code (PrologElement * parameters, PrologResolution * resolution) {
		if (parameters -> isEarth ()) return remove ();
		PrologAtom * selector = 0;
		PrologElement * a = 0, * b = 0, * c = 0, * d = 0;
		while (parameters -> isPair ()) {
			PrologElement * el = parameters -> getLeft ();
			if (el -> isAtom ()) selector = el -> getAtom ();
			else if (a == 0) a = el;
			else if (b == 0) b = el;
			else if (c == 0) c = el;
			else if (d == 0) d = el;
			parameters = parameters -> getRight ();
		}
		if (try_slide (selector, a)) return true;
		if (try_name (selector, a)) return true;
		if (try_length (selector, a)) return true;
		if (try_location (selector, a, b)) return true;
		if (try_margin (selector, a, b)) return true;
		if (try_colour (selector, a, b, c, d)) return true;
		if (try_view (selector)) return true;
		if (try_scale (selector)) return true;
		return false;
	}