contiguous testing

This commit is contained in:
Seth Trowbridge 2022-12-03 09:51:36 -05:00
parent 3ff8960038
commit 5138e25d1a
2 changed files with 23 additions and 2 deletions

View File

@ -131,7 +131,7 @@ const Update =
/** @type {(inTest:Test, inChannel:number, inIsUser:boolean)=>Array<Array<{x:number, y:number}>>} */
function Congtiguous(inTest, inChannel, inIsUser)
export function Congtiguous(inTest, inChannel, inIsUser)
{
const segments = [];
let plot;

View File

@ -1,5 +1,5 @@
import { assertEquals } from "https://deno.land/std@0.166.0/testing/asserts.ts";
import { Reducer, ColumnMapping } from "../src/store.js";
import { Reducer, ColumnMapping, Congtiguous } from "../src/store.js";
Deno.test("Store", async(t)=>
{
@ -114,4 +114,25 @@ Deno.test("Store", async(t)=>
});
})
await t.step("Contiguous Lines", ()=>
{
/** @type {import("../src/store.js").Test} */
const model = {
Name:"",
Plot:[
{Hz: 500, TestL: {Stim:30, Resp:true}, TestR: {Stim:35, Resp:true}, UserL:{Stim:20, Resp:true}},
{Hz: 1000, TestL: {Stim:40, Resp:true}, TestR: {Stim:45, Resp:true}, UserL:{Stim:30, Resp:true}},
{Hz: 2000, TestL: {Stim:40, Resp:true}, TestR: {Stim:45, Resp:true}, UserL:{Stim:30, Resp:false}},
{Hz: 3000, TestL: {Stim:30, Resp:true}, TestR: {Stim:35, Resp:true}, UserL:{Stim:20, Resp:true}},
{Hz: 4000, TestL: {Stim:40, Resp:true}, TestR: {Stim:45, Resp:true}, UserL:{Stim:30, Resp:true}},
{Hz: 4000, TestL: {Stim:50, Resp:true}, TestR: {Stim:55, Resp:true}, UserL:{Stim:40, Resp:true}}
]
}
const pieces = Congtiguous(model, 0, true);
assertEquals(pieces.length, 2);
assertEquals(pieces[0].length, 2);
assertEquals(pieces[1].length, 3);
});
});