@@ -302,6 +302,114 @@ let private tests_ArcTableProcess =
302302 let table = ArcTable.fromProcesses tableName1 processes
303303 Expect.arcTableEqual table t " Table should be equal"
304304 )
305+ ptestCase " ParamValueUnitizedNoValueNoInputOutput" ( fun () ->
306+ let t = ArcTable.init tableName1
307+ let header = CompositeHeader.Parameter oa_ temperature
308+ let unit = oa_ degreeCel
309+ let cell = CompositeCell.createUnitized ( " " , unit)
310+ t.AddColumn( header,[| cell|])
311+
312+ let processes = t.GetProcesses()
313+ Expect.equal 1 processes.Length " Should have 1 process"
314+ let p = processes.[ 0 ]
315+ Expect.equal 1 p.ParameterValues.Value.Length " Should have 1 parameter value"
316+ let pv = p.ParameterValues.Value.[ 0 ]
317+ Expect.isNone pv.Value " Should have no value"
318+ let resultCategory = Expect.wantSome pv.Category " Should have category"
319+ Expect.equal resultCategory ( ProtocolParameter.create( ParameterName = oa_ temperature)) " Category should match"
320+ let resultUnit = Expect.wantSome pv.Unit " Should have unit"
321+ Expect.equal resultUnit unit " Unit should match"
322+
323+ let t ' = ArcTable.fromProcesses tableName1 processes
324+ Expect.arcTableEqual t' t " Table should be equal"
325+ )
326+ testCase " ParamValueUnitizedNoValue" ( fun () ->
327+ let t = ArcTable.init tableName1
328+ let header = CompositeHeader.Parameter oa_ temperature
329+ let unit = oa_ degreeCel
330+ let cell = CompositeCell.createUnitized ( " " , unit)
331+ t.AddColumn( CompositeHeader.Input( IOType.Source),[| CompositeCell.createFreeText " Source" |])
332+ t.AddColumn( header,[| cell|])
333+ t.AddColumn( CompositeHeader.Output( IOType.Sample),[| CompositeCell.createFreeText " Sample" |])
334+
335+ let processes = t.GetProcesses()
336+ Expect.equal 1 processes.Length " Should have 1 process"
337+ let p = processes.[ 0 ]
338+ Expect.equal 1 p.ParameterValues.Value.Length " Should have 1 parameter value"
339+ let pv = p.ParameterValues.Value.[ 0 ]
340+ Expect.isNone pv.Value " Should have no value"
341+ let resultCategory = Expect.wantSome pv.Category " Should have category"
342+ Expect.equal resultCategory ( ProtocolParameter.create( ParameterName = oa_ temperature)) " Category should match"
343+ let resultUnit = Expect.wantSome pv.Unit " Should have unit"
344+ Expect.equal resultUnit unit " Unit should match"
345+
346+ let t ' = ArcTable.fromProcesses tableName1 processes
347+ Expect.arcTableEqual t' t " Table should be equal"
348+ )
349+ ptestCase " ParamValueUnitizedEmpty" ( fun () ->
350+ let t = ArcTable.init tableName1
351+ let header = CompositeHeader.Parameter oa_ temperature
352+ let cell = CompositeCell.createUnitized ( " " )
353+ t.AddColumn( CompositeHeader.Input( IOType.Source),[| CompositeCell.createFreeText " Source" |])
354+ t.AddColumn( header,[| cell|])
355+ t.AddColumn( CompositeHeader.Output( IOType.Sample),[| CompositeCell.createFreeText " Sample" |])
356+
357+ let processes = t.GetProcesses()
358+ Expect.equal 1 processes.Length " Should have 1 process"
359+ let p = processes.[ 0 ]
360+ Expect.equal 1 p.ParameterValues.Value.Length " Should have 1 parameter value"
361+ let pv = p.ParameterValues.Value.[ 0 ]
362+ Expect.isNone pv.Value " Should have no value"
363+ let resultCategory = Expect.wantSome pv.Category " Should have category"
364+ Expect.equal resultCategory ( ProtocolParameter.create( ParameterName = oa_ temperature)) " Category should match"
365+ Expect.isNone pv.Unit " Should have no unit"
366+
367+ let t ' = ArcTable.fromProcesses tableName1 processes
368+ Expect.arcTableEqual t' t " Table should be equal"
369+ )
370+ testCase " ParamValueUnitizedNoUnit" ( fun () ->
371+ let t = ArcTable.init tableName1
372+ let header = CompositeHeader.Parameter oa_ temperature
373+ let cell = CompositeCell.createUnitized ( " 5" )
374+ t.AddColumn( CompositeHeader.Input( IOType.Source),[| CompositeCell.createFreeText " Source" |])
375+ t.AddColumn( header,[| cell|])
376+ t.AddColumn( CompositeHeader.Output( IOType.Sample),[| CompositeCell.createFreeText " Sample" |])
377+
378+ let processes = t.GetProcesses()
379+ Expect.equal 1 processes.Length " Should have 1 process"
380+ let p = processes.[ 0 ]
381+ Expect.equal 1 p.ParameterValues.Value.Length " Should have 1 parameter value"
382+ let pv = p.ParameterValues.Value.[ 0 ]
383+ let resultValue = Expect.wantSome pv.Value " Should have value"
384+ Expect.equal resultValue ( Value.Int 5 ) " Value should match"
385+ let resultCategory = Expect.wantSome pv.Category " Should have category"
386+ Expect.equal resultCategory ( ProtocolParameter.create( ParameterName = oa_ temperature)) " Category should match"
387+ Expect.isNone pv.Unit " Should have no unit"
388+
389+ let t ' = ArcTable.fromProcesses tableName1 processes
390+ Expect.arcTableEqual t' t " Table should be equal"
391+ )
392+ testCase " ParamValueTermEmpty" ( fun () ->
393+ let t = ArcTable.init tableName1
394+ let header = CompositeHeader.Parameter oa_ species
395+ let cell = CompositeCell.createTerm ( OntologyAnnotation.create())
396+ t.AddColumn( CompositeHeader.Input( IOType.Source),[| CompositeCell.createFreeText " Source" |])
397+ t.AddColumn( header,[| cell|])
398+ t.AddColumn( CompositeHeader.Output( IOType.Sample),[| CompositeCell.createFreeText " Sample" |])
399+
400+ let processes = t.GetProcesses()
401+ Expect.equal 1 processes.Length " Should have 1 process"
402+ let p = processes.[ 0 ]
403+ Expect.equal 1 p.ParameterValues.Value.Length " Should have 1 parameter value"
404+ let pv = p.ParameterValues.Value.[ 0 ]
405+ Expect.isNone pv.Value " Should have no value"
406+ let resultCategory = Expect.wantSome pv.Category " Should have category"
407+ Expect.equal resultCategory ( ProtocolParameter.create( ParameterName = oa_ species)) " Category should match"
408+ Expect.isNone pv.Unit " Should have no unit"
409+
410+ let t ' = ArcTable.fromProcesses tableName1 processes
411+ Expect.arcTableEqual t' t " Table should be equal"
412+ )
305413 ]
306414
307415let private tests_ArcTablesProcessSeq =
0 commit comments