Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F136066
app_test.go
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Subscribers
None
app_test.go
View Options
package
sshtunnel
import
(
"testing"
"fmt"
)
//function
func
TestEndPointString
(
t
*
testing
.
T
)
{
var
testend
Endpoint
testend
.
Host
=
"localhost"
testend
.
Port
=
5555
// make a string and test what the string should be
stringWant
:=
"localhost:5555"
returnedString
:=
testend
.
String
()
fmt
.
Printf
(
"\nstringWant: %s\n\n"
,
stringWant
)
fmt
.
Printf
(
"returnedString : %s\n\n"
,
returnedString
)
// return string == stringwant // success
}
//function
func
TestEndPointParseString
(
t
*
testing
.
T
)
{
var
testRemote
,
testRemote1
Endpoint
var
testLocal
,
testLocal1
Endpoint
// make a string and test what the string should be
testLocal
,
testRemote
=
ParseEndpointString
(
"5555:motherbrain.unr.edu:5555"
)
testLocal1
,
testRemote1
=
ParseEndpointString
(
"27013:motherbrain.unr.edu:27013"
)
fmt
.
Printf
(
"Local: %s %d\n\n"
,
testLocal
.
Host
,
testLocal
.
Port
)
fmt
.
Printf
(
"Remote: %s %d \n\n"
,
testRemote
.
Host
,
testRemote
.
Port
)
fmt
.
Printf
(
"Local: %s %d\n\n"
,
testLocal1
.
Host
,
testLocal1
.
Port
)
fmt
.
Printf
(
"Remote: %s %d \n\n"
,
testRemote1
.
Host
,
testRemote1
.
Port
)
if
testLocal
.
Host
!=
"localhost"
{
t
.
Error
(
"Invalid Local EP Hostname"
)
}
if
testLocal
.
Port
!=
5555
{
t
.
Error
(
"Invalid Local EP Port"
)
}
if
testRemote
.
Host
!=
"motherbrain.unr.edu"
{
t
.
Error
(
"Invalid remote EP Hostname"
)
}
if
testRemote
.
Port
!=
5555
{
t
.
Error
(
"Invalid remote EP Port"
)
}
////////////////////////////////////////
if
testLocal1
.
Host
!=
"localhost"
{
t
.
Error
(
"Invalid Local EP Hostname"
)
}
if
testLocal1
.
Port
!=
27013
{
t
.
Error
(
"Invalid Local EP Port"
)
}
if
testRemote1
.
Host
!=
"motherbrain.unr.edu"
{
t
.
Error
(
"Invalid remote EP Hostname"
)
}
if
testRemote1
.
Port
!=
27013
{
t
.
Error
(
"Invalid remote EP Port"
)
}
// return string == stringwant // success
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Feb 24, 6:22 AM (15 h, 55 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15200
Default Alt Text
app_test.go (1 KB)
Attached To
rST sshtunnel
Event Timeline
Log In to Comment