diff --git a/api/coreg/import_test.go b/api/coreg/import_test.go index 7fe82dda..3a18d29e 100644 --- a/api/coreg/import_test.go +++ b/api/coreg/import_test.go @@ -1,6 +1,7 @@ package coreg import ( + "encoding/json" "fmt" "log" @@ -14,6 +15,16 @@ func printWarpXform(xform *protos.ImageMatchTransform, name string, err error) { if b, err := protojson.Marshal(xform); err != nil { log.Fatalln(err) } else { + // Proto isn't deterministic, so we read as JSON and write it back out again + var anyJson map[string]interface{} + err = json.Unmarshal(b, &anyJson) + if err != nil { + log.Fatalln(err) + } + b, err = json.MarshalIndent(anyJson, "", " ") + if err != nil { + log.Fatalln(err) + } fmt.Printf("%v\n", string(b)) } } @@ -33,13 +44,33 @@ func Example_readWarpedImageTransform() { // Output: // coreg-40_519-SC3_0921_0748732957_027RAS_N0450000SRLC11373_0000LMJ01-A.png| - // {"xOffset":40, "yOffset":519, "xScale":4.478153, "yScale":4.478153} + // { + // "xOffset": 40, + // "xScale": 4.478153, + // "yOffset": 519, + // "yScale": 4.478153 + // } // coreg-186_216-PCB_0921_0748739251_000RAS_N045000032302746300020LUJ01-A.png| - // {"xOffset":186, "yOffset":216, "xScale":1.1359178, "yScale":1.1359178} + // { + // "xOffset": 186, + // "xScale": 1.1359178, + // "yOffset": 216, + // "yScale": 1.1359178 + // } // coreg-40_519-SC3_0921_0748732957_027RAS_N0450000SRLC11373_0000LMJ01.png| - // {"xOffset":40, "yOffset":519, "xScale":4.478153, "yScale":4.478153} + // { + // "xOffset": 40, + // "xScale": 4.478153, + // "yOffset": 519, + // "yScale": 4.478153 + // } // coreg-186_216-PCB_0921_0748739251_000RAS_N045000032302746300020LUJ01.png| - // {"xOffset":186, "yOffset":216, "xScale":1.1359178, "yScale":1.1359178} + // { + // "xOffset": 186, + // "xScale": 1.1359178, + // "yOffset": 216, + // "yScale": 1.1359178 + // } // |Warped image name does not have expected components // {} // |Failed to find GDS file name section in image name: SC3_0921_0748732957_027RASS_N0450000SRLC11373_0000LMJ01. Error: Failed to parse meta from file name