test cleanup
This commit is contained in:
		
							parent
							
								
									d0cdae0475
								
							
						
					
					
						commit
						b1ca18cc4c
					
				@ -11,19 +11,22 @@ func Test_Encode(t *testing.T) {
 | 
				
			|||||||
		t.Error("\"FOOBAR\" should not be encodable")
 | 
							t.Error("\"FOOBAR\" should not be encodable")
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	code, err := Encode("A40156B")
 | 
						testEncode := func(txt, testResult string) {
 | 
				
			||||||
	if err != nil || code == nil {
 | 
							code, err := Encode(txt)
 | 
				
			||||||
		t.Fail()
 | 
							if err != nil || code == nil {
 | 
				
			||||||
	} else {
 | 
								t.Fail()
 | 
				
			||||||
		testResult := "10110010010101101001010101001101010110010110101001010010101101010010011"
 | 
					 | 
				
			||||||
		if code.Bounds().Max.X != len(testResult) {
 | 
					 | 
				
			||||||
			t.Error("length missmatch")
 | 
					 | 
				
			||||||
		} else {
 | 
							} else {
 | 
				
			||||||
			for i, r := range testResult {
 | 
								if code.Bounds().Max.X != len(testResult) {
 | 
				
			||||||
				if (code.At(i, 0) == color.Black) != (r == '1') {
 | 
									t.Errorf("%v: length missmatch", txt)
 | 
				
			||||||
					t.Errorf("code missmatch on position %d", i)
 | 
								} else {
 | 
				
			||||||
 | 
									for i, r := range testResult {
 | 
				
			||||||
 | 
										if (code.At(i, 0) == color.Black) != (r == '1') {
 | 
				
			||||||
 | 
											t.Errorf("%v: code missmatch on position %d", txt, i)
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						testEncode("A40156B", "10110010010101101001010101001101010110010110101001010010101101010010011")
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user