예제 #1
0
void down(int i)
{
    int vetsi, j;

    while(1){

       j = i << 1;
       if(j > sn) return;
       if(j+1 > sn) vetsi=1;
       else vetsi = isGE(j,j+1);

       if(vetsi) if isGE(i,j) return; else { swapx(j,i); i=j; }
       else if(isGE(i,j+1)) return; else { swapx(j+1,i); i=j+1; }
예제 #2
0
void
test_write_all(void)
{
	int fd = ux_socket_connect("/socket");

	TEST_ASSERT_TRUE(isGE(fd, 0));

	char * str = "TEST123";
	int temp = write_all(fd, str,strlen(str));
	TEST_ASSERT_EQUAL(strlen(str), temp);

	(void)close(fd);
	return;
}
예제 #3
0
void
test_send_packet(void)
{
	int fd = ux_socket_connect("/socket");

	TEST_ASSERT_TRUE(isGE(fd, 0));

	char * str2 = "PACKET12345";
	int temp = send_packet(fd, str2, strlen(str2));

	TEST_ASSERT_EQUAL(0,temp);

	(void)close(fd);
	return;
}
예제 #4
0
void 
test_connect_correct_socket(void)
{
	int temp = ux_socket_connect("/socket");

	//risky, what if something is listening on :123, or localhost isnt 127.0.0.1?
	//TEST_ASSERT_EQUAL(-1, ux_socket_connect("127.0.0.1:123")); 

	//printf("%d\n",temp);
	TEST_ASSERT_TRUE(isGE(temp,0));

	//write_all();
	//char *socketName = "Random_Socket_Name";
	//int length = strlen(socketName);

	return;
}
예제 #5
0
/*
** HMS: What's going on here?
** Looks like this needs more work.
*/
void
test_recv_packet(void)
{
	int fd = ux_socket_connect("/socket");

	TEST_ASSERT_TRUE(isGE(fd, 0));

	uint32_t size = 256;	
	char *str = NULL;
	int temp = recv_packet(fd, &str, &size);

	send_packet(fd, str, strlen(str));
	free(str);
	TEST_ASSERT_EQUAL(0,temp); //0 because nobody sent us anything (yet!)

	(void)close(fd);
	return;
}