diff --git a/src/geometry/polygon.ts b/src/geometry/polygon.ts index 002757f1..878a8e00 100644 --- a/src/geometry/polygon.ts +++ b/src/geometry/polygon.ts @@ -45,4 +45,8 @@ export class Polygon extends Array { const yCoords = this.getMinMaxY(); return isPointInY(point, yCoords.min, yCoords.max); } + + toString(): string { + return this.map((point) => `(${point})`).join(", "); + } } diff --git a/src/v2/parsing/inference/baseInference.ts b/src/v2/parsing/inference/baseInference.ts index d0aacae4..9df645bf 100644 --- a/src/v2/parsing/inference/baseInference.ts +++ b/src/v2/parsing/inference/baseInference.ts @@ -32,6 +32,7 @@ export abstract class BaseInference { return ( "Inference\n" + "#########\n" + + this.job.toString() + "\n" + this.model.toString() + "\n" + this.file.toString() + "\n" ); diff --git a/tests/data b/tests/data index 37f2e3de..a4b3fbe9 160000 --- a/tests/data +++ b/tests/data @@ -1 +1 @@ -Subproject commit 37f2e3de48918e3b1a0e4604a9292aaeae05c637 +Subproject commit a4b3fbe943ac2be84847e11f97538fd6d6e75b1d diff --git a/tests/v2/product/crop.spec.ts b/tests/v2/product/crop.spec.ts index 6540ac0c..eef9e7b5 100644 --- a/tests/v2/product/crop.spec.ts +++ b/tests/v2/product/crop.spec.ts @@ -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"; @@ -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); + }); + }); });