16 lines
		
	
	
		
			219 B
		
	
	
	
		
			Go
		
	
	
	
	
	
		
		
			
		
	
	
			16 lines
		
	
	
		
			219 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| 
								 | 
							
								package common
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								import "testing"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								func TestBytesConversion(t *testing.T) {
							 | 
						||
| 
								 | 
							
									bytes := []byte{5}
							 | 
						||
| 
								 | 
							
									hash := BytesToHash(bytes)
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
									var exp Hash
							 | 
						||
| 
								 | 
							
									exp[31] = 5
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
									if hash != exp {
							 | 
						||
| 
								 | 
							
										t.Errorf("expected %x got %x", exp, hash)
							 | 
						||
| 
								 | 
							
									}
							 | 
						||
| 
								 | 
							
								}
							 |