Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/geometry/polygon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,8 @@ export class Polygon extends Array<Point> {
const yCoords = this.getMinMaxY();
return isPointInY(point, yCoords.min, yCoords.max);
}

toString(): string {
return this.map((point) => `(${point})`).join(", ");
}
}
1 change: 1 addition & 0 deletions src/v2/parsing/inference/baseInference.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export abstract class BaseInference {
return (
"Inference\n" +
"#########\n" +
this.job.toString() + "\n" +
this.model.toString() + "\n" +
this.file.toString() + "\n"
);
Expand Down
2 changes: 1 addition & 1 deletion tests/data
15 changes: 15 additions & 0 deletions tests/v2/product/crop.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import path from "path";
import assert from "node:assert/strict";
import { promises as fs } from "fs";
import { describe, it } from "node:test";
import { Polygon } from "@/geometry/index.js";
import { crop } from "@/v2/product/index.js";
Expand Down Expand Up @@ -101,4 +102,18 @@ describe("MindeeV2 - Crop Response", async () => {
assert.strictEqual(secondPolygon[3][0], 0.547);
assert.strictEqual(secondPolygon[3][1], 0.97);
});

describe("RST Display", async () => {
it("to be properly exposed", async () => {
const response = await loadV2Response(
crop.CropResponse,
path.join(V2_PRODUCT_PATH, "crop", "crop_single.json")
);
const rstString = await fs.readFile(
path.join(V2_PRODUCT_PATH, "crop", "crop_single.rst"), "utf8"
);
assert.notStrictEqual(response.inference, null);
assert.strictEqual(response.inference.toString(), rstString);
});
});
});