Skip to content

qops1981/wrd-stg-to-ip

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Interview Homework (String INT to IP)

William DeLuca

Ruby

Gem Dependencies

  • test-unit

IP_Address Class

This class allows an input that will then be converted into the following:

  • String Representation of an IP address (e.g. 98.210.237.75)
  • Integer Representation of an IP address (e.g. 1657990475)
  • Hexadecimal Representation of an IP address (e.g. 0x62D2ED4B)

Examples

# Example 1
ip = IP_Address.new
ip.hexa_ip = '0x62D2ED4B'

ip.string_ip 	#=> '98.210.237.75'
ip.hexa_ip 		#=> '0x62D2ED4B'
ip.int_ip 		#=> 1657990475

Unit Testing

Testing setup to a list of explicit scenarios

./test_ip.rb

Python3

Examples

# Example 1
ip = IP_Address()
ip.hexa_ip = '0x62D2ED4B'

ip.string_ip 	#=> '98.210.237.75'
ip.hexa_ip 		#=> '0x62d2ed4b'
ip.int_ip 		#=> 1657990475

Unit Testing

Testing setup to a list of explicit scenarios

./test_ip.py

About

String to IP Homework

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published