Skip to content

Commit

Permalink
Added Test Implementation for the Getters of OMRAddrInfoNode
Browse files Browse the repository at this point in the history
Added test implementations for per_thread_buffer_functionality test

- Added implementations to first create a hints structure, which
  relies on the per thread buffer structure and functions.
- Added values to hints, which is stored by per thread buffer
  and the element getters retrieves the values and compare
  them to values inserted.

Issue: eclipse-omr#4745

Depends on PR:eclipse-omr#4555

Signed-off-by: Haley Cao <haleycao88@hotmail.com>
  • Loading branch information
Haley Cao committed Jan 22, 2020
1 parent ea48852 commit 41d7e16
Showing 1 changed file with 23 additions and 4 deletions.
27 changes: 23 additions & 4 deletions fvtest/porttest/omrsockTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,33 @@ TEST(PortSockTest, per_thread_buffer_functionality)
OMRPORT_ACCESS_FROM_OMRPORT(portTestEnv->getPortLibrary());

omrsock_addrinfo_t hints = NULL;
uint32_t length = 0;
int32_t family = 0;
int32_t sockType = 1;
int32_t protocol = 1;
int32_t flags = 0;
int32_t sockType = 0;
int32_t protocol = 0;

OMRPORTLIB->sock_getaddrinfo_create_hints(OMRPORTLIB, &hints, family, sockType, protocol, flags);
int32_t hintsFamily = 0;
int32_t hintsSockType = 1;
int32_t hintsProtocol = 1;
int32_t hintsFlags = 0;

OMRPORTLIB->sock_getaddrinfo_create_hints(OMRPORTLIB, &hints, hintsFamily, hintsSockType, hintsProtocol, hintsFlags);

ASSERT_NE(hints, (void *)NULL);

/* Get and verify elements of the newly created hints. */
OMRPORTLIB->sock_getaddrinfo_length(OMRPORTLIB, hints, &length);
EXPECT_EQ(length, 0);

OMRPORTLIB->sock_getaddrinfo_family(OMRPORTLIB, hints, &family, 0);
EXPECT_EQ(family, hintsFamily);

OMRPORTLIB->sock_getaddrinfo_socktype(OMRPORTLIB, hints, &sockType, 0);
EXPECT_EQ(sockType, hintsSockType);

OMRPORTLIB->sock_getaddrinfo_protocol(OMRPORTLIB, hints, &protocol, 0);
EXPECT_EQ(protocol, hintsProtocol);

}

/**
Expand Down

0 comments on commit 41d7e16

Please sign in to comment.