mirror of
				https://github.com/miekg/dns.git
				synced 2025-11-04 04:31:01 +01:00 
			
		
		
		
	Added tests for the cmToM function to make sure that it's output is correct. Modified the way the Altitude is written to a string. Previously, if the altitude was an exact number of meters it would always be reported with two decimal places. This is not needed. Conversely if it was not an exact number of meters the cm were removed.
		
			
				
	
	
		
			43 lines
		
	
	
		
			467 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			43 lines
		
	
	
		
			467 B
		
	
	
	
		
			Go
		
	
	
	
	
	
package dns
 | 
						|
 | 
						|
import (
 | 
						|
	"testing"
 | 
						|
)
 | 
						|
 | 
						|
func TestCmToM(t *testing.T) {
 | 
						|
	s := cmToM(0, 0)
 | 
						|
	if s != "0.00" {
 | 
						|
		t.Error("0, 0")
 | 
						|
	}
 | 
						|
 | 
						|
	s = cmToM(1, 0)
 | 
						|
	if s != "0.01" {
 | 
						|
		t.Error("1, 0")
 | 
						|
	}
 | 
						|
 | 
						|
	s = cmToM(3, 1)
 | 
						|
	if s != "0.30" {
 | 
						|
		t.Error("3, 1")
 | 
						|
	}
 | 
						|
 | 
						|
	s = cmToM(4, 2)
 | 
						|
	if s != "4" {
 | 
						|
		t.Error("4, 2")
 | 
						|
	}
 | 
						|
 | 
						|
	s = cmToM(5, 3)
 | 
						|
	if s != "50" {
 | 
						|
		t.Error("5, 3")
 | 
						|
	}
 | 
						|
 | 
						|
	s = cmToM(7, 5)
 | 
						|
	if s != "7000" {
 | 
						|
		t.Error("7, 5")
 | 
						|
	}
 | 
						|
 | 
						|
	s = cmToM(9, 9)
 | 
						|
	if s != "90000000" {
 | 
						|
		t.Error("9, 9")
 | 
						|
	}
 | 
						|
}
 |