From 29c4e73b94f767a0dfa044eb6572a2bed8e5fa22 Mon Sep 17 00:00:00 2001 From: porink0424 Date: Wed, 26 Jun 2024 10:34:32 +0900 Subject: [PATCH] Add the test for checking the distribution property as well --- tslib/storage/test/journal.test.mjs | 42 +++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/tslib/storage/test/journal.test.mjs b/tslib/storage/test/journal.test.mjs index 70e4f7a5..a9bb4c04 100644 --- a/tslib/storage/test/journal.test.mjs +++ b/tslib/storage/test/journal.test.mjs @@ -22,10 +22,52 @@ describe("Test Journal File Storage", async () => { study.union_search_space.map((item) => item.name).sort(), ["x", "x", "category"].sort() ) + assert.strictEqual( + study.union_search_space.some( + (item) => + item.name === "category" && + item.distribution.type === "CategoricalDistribution" && + item.distribution.choices.length === 2 + ), + true + ) + assert.strictEqual( + study.union_search_space.some( + (item) => + item.name === "x" && + item.distribution.type === "FloatDistribution" && + item.distribution.low === 0 && + item.distribution.high === 10 && + item.distribution.step === null && + item.distribution.log === false + ), + true + ) + assert.strictEqual( + study.union_search_space.some( + (item) => + item.name === "x" && + item.distribution.type === "FloatDistribution" && + item.distribution.low === -10 && + item.distribution.high === 0 && + item.distribution.step === null && + item.distribution.log === false + ), + true + ) assert.deepStrictEqual( study.intersection_search_space.map((item) => item.name).sort(), ["category"].sort() ) + assert.strictEqual( + study.intersection_search_space.some( + (item) => + item.name === "category" && + item.distribution.type === "CategoricalDistribution" && + item.distribution.choices.length === 2 + ), + true + ) }) it("Check the study including Infinities", () => {