| 
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -87,3 +87,40 @@ func TestDecodeString(t *testing.T) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					type errTest struct { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						in  string | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						out string | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						err error | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					var errTests = []errTest{ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						{"", "", nil}, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						{"c", "", ErrLength}, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						{"zteff", "", InvalidByteError('z')}, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						{"dtefz", "\x2d\x34", InvalidByteError('z')}, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						{"ecebe", "01", ErrLength}, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						{"cq", "", InvalidByteError('q')}, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						{"ccqq", "\x00", InvalidByteError('q')}, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						{"c\x01", "", InvalidByteError('\x01')}, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						{"vvuut", "\xff\xee", ErrLength}, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					func TestDecodeErr(t *testing.T) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						for i, test := range errTests { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							out := make([]byte, len(test.in)+10) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							n, err := Decode(out, []byte(test.in)) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							if string(out[:n]) != test.out || err != test.err { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								t.Errorf("#%d: Decode(%q) = %q, %v, want %q, %v", i, test.in, string(out[:n]), err, test.out, test.err) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					func TestDecodeStringErr(t *testing.T) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						for i, test := range errTests { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							out, err := DecodeString(test.in) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							if string(out) != test.out || err != test.err { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								t.Errorf("#%d: DecodeString(%q) = %q, %v, want %q, %v", i, test.in, out, err, test.out, test.err) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					} |