import { InsertRangeAndUnion, RangeUnion } from "../../src/DatabaseServices/Room/ParseService/RangeUtils"; test('range', () => { //测试用例 expect(InsertRangeAndUnion([[0.2, 0.3], [0.4, 0.5]], 0.25, 0.35)).toMatchSnapshot(); expect(InsertRangeAndUnion([[0.2, 0.3], [0.4, 0.5]], 0.25, 0.45)).toMatchSnapshot(); expect(InsertRangeAndUnion([[0.2, 0.3], [0.4, 0.5], [0.6, 0.7]], 0.25, 0.65)).toMatchSnapshot(); expect(InsertRangeAndUnion([[0.2, 0.3], [0.4, 0.5]], 0.35, 0.45)).toMatchSnapshot(); expect(InsertRangeAndUnion([[0.2, 0.3], [0.4, 0.5]], 0.35, 0.36)).toMatchSnapshot(); expect(InsertRangeAndUnion([[0.2, 0.3], [0.4, 0.5]], 0, 0.8)).toMatchSnapshot(); expect(InsertRangeAndUnion([[0.2, 0.3], [0.4, 0.5], [0.7, 0.9]], 0, 0.8)).toMatchSnapshot(); expect(InsertRangeAndUnion([[0.2, 0.3], [0.4, 0.5], [0.9, 1]], 0, 0.8)).toMatchSnapshot(); expect(InsertRangeAndUnion([[0.2, 0.3], [0.4, 0.5], [0.6, 0.7], [0.9, 1]], 0, 0.9)).toMatchSnapshot(); expect(RangeUnion([[0, 0.2], [0.15, 0.3], [0.2, 0.4], [0.8, 1], [1.2, 1.4], [1.1, 1.5]])).toMatchSnapshot(); //误差 expect(InsertRangeAndUnion([[0.2, 0.3], [0.4, 0.5]], 0.30000000000001, 0.35)).toMatchSnapshot(); expect(InsertRangeAndUnion([[0.2, 0.3], [0.4, 0.5]], 0.299999999, 0.35)).toMatchSnapshot(); });