update to tests. parameterized.

udpate to tests. refactor using parameters.

move dotsource base.ps1 into lower.

set test version to banana
This commit is contained in:
onyx-and-iris 2022-01-24 19:56:34 +00:00
parent 0d23b4eac3
commit ff1839313f
3 changed files with 202 additions and 1274 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,409 +1,54 @@
Describe -Tag 'lower', -TestName 'All Tests' {
Describe 'Macrobutton Tests' {
Context 'mode = State' {
It 'Should set macrobutton[0] State to 1' {
MB_Set -ID 0 -SET 1 -MODE 1
MB_Get -ID 0 -MODE 1 | Should -Be 1
BeforeAll {
. ..\lib\base.ps1
}
It 'Should set macrobutton[0] State to 0' {
MB_Set -ID 0 -SET 0 -MODE 1
MB_Get -ID 0 -MODE 1 | Should -Be 0
Describe -Tag 'lower', -TestName 'All Lower Tests' {
Describe 'Macrobutton Tests' -ForEach @(
@{ Value = 1; Expected = 1 }
@{ Value = 0; Expected = 0 }
){
Context 'buttons 0, 69' -ForEach @(
@{ Index = 0 }, @{ Index = 69 }
){
Context 'state, stateonly and trigger' -ForEach @(
@{ Mode = 1 }, @{ Mode = 2 }, @{ Mode = 3 }
){
It "Should set and get macrobutton[$index] State" {
MB_Set -ID $index -SET $value -MODE $mode
MB_Get -ID $index -MODE $mode | Should -Be $expected
}
It 'Should set macrobutton[1] State to 1' {
MB_Set -ID 1 -SET 1 -MODE 1
MB_Get -ID 1 -MODE 1 | Should -Be 1
}
It 'Should set macrobutton[1] State to 0' {
MB_Set -ID 1 -SET 0 -MODE 1
MB_Get -ID 1 -MODE 1 | Should -Be 0
}
It 'Should set macrobutton[2] State to 1' {
MB_Set -ID 2 -SET 1 -MODE 1
MB_Get -ID 2 -MODE 1 | Should -Be 1
}
It 'Should set macrobutton[2] State to 0' {
MB_Set -ID 2 -SET 0 -MODE 1
MB_Get -ID 2 -MODE 1 | Should -Be 0
}
}
Context 'mode = StateOnly' {
It 'Should set macrobutton[0] StateOnly to 1' {
MB_Set -ID 0 -SET 1 -MODE 2
MB_Get -ID 0 -MODE 2 | Should -Be 1
}
It 'Should set macrobutton[0] StateOnly to 0' {
MB_Set -ID 0 -SET 0 -MODE 2
MB_Get -ID 0 -MODE 2 | Should -Be 0
}
It 'Should set macrobutton[1] StateOnly to 1' {
MB_Set -ID 1 -SET 1 -MODE 2
MB_Get -ID 1 -MODE 2 | Should -Be 1
}
It 'Should set macrobutton[1] StateOnly to 0' {
MB_Set -ID 1 -SET 0 -MODE 2
MB_Get -ID 1 -MODE 2 | Should -Be 0
}
It 'Should set macrobutton[2] StateOnly to 1' {
MB_Set -ID 2 -SET 1 -MODE 2
MB_Get -ID 2 -MODE 2 | Should -Be 1
}
It 'Should set macrobutton[2] StateOnly to 0' {
MB_Set -ID 2 -SET 0 -MODE 2
MB_Get -ID 2 -MODE 2 | Should -Be 0
}
}
Context 'mode = Trigger' {
It 'Should set macrobutton[0] Trigger to 1' {
MB_Set -ID 0 -SET 1 -MODE 3
MB_Get -ID 0 -MODE 3 | Should -Be 1
}
It 'Should set macrobutton[0] Trigger to 0' {
MB_Set -ID 0 -SET 0 -MODE 3
MB_Get -ID 0 -MODE 3 | Should -Be 0
}
It 'Should set macrobutton[1] Trigger to 1' {
MB_Set -ID 1 -SET 1 -MODE 3
MB_Get -ID 1 -MODE 3 | Should -Be 1
}
It 'Should set macrobutton[1] Trigger to 0' {
MB_Set -ID 1 -SET 0 -MODE 3
MB_Get -ID 1 -MODE 3 | Should -Be 0
}
It 'Should set macrobutton[2] Trigger to 1' {
MB_Set -ID 2 -SET 1 -MODE 3
MB_Get -ID 2 -MODE 3 | Should -Be 1
}
It 'Should set macrobutton[2] Trigger to 0' {
MB_Set -ID 2 -SET 0 -MODE 3
MB_Get -ID 2 -MODE 3 | Should -Be 0
}
}
}
Describe 'Set and Get Param Float Tests' {
Context 'Strip[i].Mute' {
It 'Should set Strip[0].Mute to 1' {
Param_Set -PARAM "Strip[0].Mute" -VALUE 1
Param_Get -PARAM "Strip[0].Mute" | Should -Be 1
}
It 'Should set Strip[0].Mute to 0' {
Param_Set -PARAM "Strip[0].Mute" -VALUE 0
Param_Get -PARAM "Strip[0].Mute" | Should -Be 0
}
It 'Should set Strip[1].Mute to 1' {
Param_Set -PARAM "Strip[1].Mute" -VALUE 1
Param_Get -PARAM "Strip[1].Mute" | Should -Be 1
}
It 'Should set Strip[1].Mute to 0' {
Param_Set -PARAM "Strip[1].Mute" -VALUE 0
Param_Get -PARAM "Strip[1].Mute" | Should -Be 0
}
It 'Should set Strip[2].Mute to 1' {
Param_Set -PARAM "Strip[2].Mute" -VALUE 1
Param_Get -PARAM "Strip[2].Mute" | Should -Be 1
}
It 'Should set Strip[2].Mute to 0' {
Param_Set -PARAM "Strip[2].Mute" -VALUE 0
Param_Get -PARAM "Strip[2].Mute" | Should -Be 0
}
}
Context 'Strip[i].Solo' {
It 'Should set Strip[0].Solo to 1' {
Param_Set -PARAM "Strip[0].Solo" -VALUE 1
Param_Get -PARAM "Strip[0].Solo" | Should -Be 1
}
It 'Should set Strip[0].Solo to 0' {
Param_Set -PARAM "Strip[0].Solo" -VALUE 0
Param_Get -PARAM "Strip[0].Solo" | Should -Be 0
}
It 'Should set Strip[1].Solo to 1' {
Param_Set -PARAM "Strip[1].Solo" -VALUE 1
Param_Get -PARAM "Strip[1].Solo" | Should -Be 1
}
It 'Should set Strip[1].Solo to 0' {
Param_Set -PARAM "Strip[1].Solo" -VALUE 0
Param_Get -PARAM "Strip[1].Solo" | Should -Be 0
}
It 'Should set Strip[2].Solo to 1' {
Param_Set -PARAM "Strip[2].Solo" -VALUE 1
Param_Get -PARAM "Strip[2].Solo" | Should -Be 1
}
It 'Should set Strip[2].Solo to 0' {
Param_Set -PARAM "Strip[2].Solo" -VALUE 0
Param_Get -PARAM "Strip[2].Solo" | Should -Be 0
}
}
Context 'Strip[i].Mono' {
It 'Should set Strip[0].Mono to 1' {
Param_Set -PARAM "Strip[0].Mono" -VALUE 1
Param_Get -PARAM "Strip[0].Mono" | Should -Be 1
}
It 'Should set Strip[0].Mono to 0' {
Param_Set -PARAM "Strip[0].Mono" -VALUE 0
Param_Get -PARAM "Strip[0].Mono" | Should -Be 0
}
It 'Should set Strip[1].Mono to 1' {
Param_Set -PARAM "Strip[1].Mono" -VALUE 1
Param_Get -PARAM "Strip[1].Mono" | Should -Be 1
}
It 'Should set Strip[1].Mono to 0' {
Param_Set -PARAM "Strip[1].Mono" -VALUE 0
Param_Get -PARAM "Strip[1].Mono" | Should -Be 0
Describe 'Set and Get Param Float Tests' -ForEach @(
@{ Value = 1; Expected = 1 }
@{ Value = 0; Expected = 0 }
){
Context 'Strip, one physical one virtual' -ForEach @(
@{ Index = 0 }, @{ Index = 4 }
){
Context 'mute, mono, A1, B2' -ForEach @(
@{ param = "mute" }, @{ param = "A1" }
){
It "Should set Strip[0].$param to 1" {
Param_Set -PARAM "Strip[$index].$param" -VALUE $value
Param_Get -PARAM "Strip[$index].$param" | Should -Be $value
}
It 'Should set Strip[2].Mono to 1' {
Param_Set -PARAM "Strip[2].Mono" -VALUE 1
Param_Get -PARAM "Strip[2].Mono" | Should -Be 1
}
It 'Should set Strip[2].Mono to 0' {
Param_Set -PARAM "Strip[2].Mono" -VALUE 0
Param_Get -PARAM "Strip[2].Mono" | Should -Be 0
}
}
Context 'Strip[i].A1' {
It 'Should set Strip[0].A1 to 1' {
Param_Set -PARAM "Strip[0].A1" -VALUE 1
Param_Get -PARAM "Strip[0].A1" | Should -Be 1
}
It 'Should set Strip[0].A1 to 0' {
Param_Set -PARAM "Strip[0].A1" -VALUE 0
Param_Get -PARAM "Strip[0].A1" | Should -Be 0
}
It 'Should set Strip[1].A1 to 1' {
Param_Set -PARAM "Strip[1].A1" -VALUE 1
Param_Get -PARAM "Strip[1].A1" | Should -Be 1
}
It 'Should set Strip[1].A1 to 0' {
Param_Set -PARAM "Strip[1].A1" -VALUE 0
Param_Get -PARAM "Strip[1].A1" | Should -Be 0
}
It 'Should set Strip[2].A1 to 1' {
Param_Set -PARAM "Strip[2].A1" -VALUE 1
Param_Get -PARAM "Strip[2].A1" | Should -Be 1
}
It 'Should set Strip[2].A1 to 0' {
Param_Set -PARAM "Strip[2].A1" -VALUE 0
Param_Get -PARAM "Strip[2].A1" | Should -Be 0
}
}
Context 'Strip[i].A2' {
It 'Should set Strip[0].A2 to 1' {
Param_Set -PARAM "Strip[0].A2" -VALUE 1
Param_Get -PARAM "Strip[0].A2" | Should -Be 1
}
It 'Should set Strip[0].A2 to 0' {
Param_Set -PARAM "Strip[0].A2" -VALUE 0
Param_Get -PARAM "Strip[0].A2" | Should -Be 0
}
It 'Should set Strip[1].A2 to 1' {
Param_Set -PARAM "Strip[1].A2" -VALUE 1
Param_Get -PARAM "Strip[1].A2" | Should -Be 1
}
It 'Should set Strip[1].A2 to 0' {
Param_Set -PARAM "Strip[1].A2" -VALUE 0
Param_Get -PARAM "Strip[1].A2" | Should -Be 0
}
It 'Should set Strip[2].A2 to 1' {
Param_Set -PARAM "Strip[2].A2" -VALUE 1
Param_Get -PARAM "Strip[2].A2" | Should -Be 1
}
It 'Should set Strip[2].A2 to 0' {
Param_Set -PARAM "Strip[2].A2" -VALUE 0
Param_Get -PARAM "Strip[2].A2" | Should -Be 0
}
}
Context 'Strip[i].A3' {
It 'Should set Strip[0].A3 to 1' {
Param_Set -PARAM "Strip[0].A3" -VALUE 1
Param_Get -PARAM "Strip[0].A3" | Should -Be 1
}
It 'Should set Strip[0].A3 to 0' {
Param_Set -PARAM "Strip[0].A3" -VALUE 0
Param_Get -PARAM "Strip[0].A3" | Should -Be 0
}
It 'Should set Strip[1].A3 to 1' {
Param_Set -PARAM "Strip[1].A3" -VALUE 1
Param_Get -PARAM "Strip[1].A3" | Should -Be 1
}
It 'Should set Strip[1].A3 to 0' {
Param_Set -PARAM "Strip[1].A3" -VALUE 0
Param_Get -PARAM "Strip[1].A3" | Should -Be 0
}
It 'Should set Strip[2].A3 to 1' {
Param_Set -PARAM "Strip[2].A3" -VALUE 1
Param_Get -PARAM "Strip[2].A3" | Should -Be 1
}
It 'Should set Strip[2].A3 to 0' {
Param_Set -PARAM "Strip[2].A3" -VALUE 0
Param_Get -PARAM "Strip[2].A3" | Should -Be 0
}
}
Context 'Strip[i].B1' {
It 'Should set Strip[0].B1 to 1' {
Param_Set -PARAM "Strip[0].B1" -VALUE 1
Param_Get -PARAM "Strip[0].B1" | Should -Be 1
}
It 'Should set Strip[0].B1 to 0' {
Param_Set -PARAM "Strip[0].B1" -VALUE 0
Param_Get -PARAM "Strip[0].B1" | Should -Be 0
}
It 'Should set Strip[1].B1 to 1' {
Param_Set -PARAM "Strip[1].B1" -VALUE 1
Param_Get -PARAM "Strip[1].B1" | Should -Be 1
}
It 'Should set Strip[1].B1 to 0' {
Param_Set -PARAM "Strip[1].B1" -VALUE 0
Param_Get -PARAM "Strip[1].B1" | Should -Be 0
}
It 'Should set Strip[2].B1 to 1' {
Param_Set -PARAM "Strip[2].B1" -VALUE 1
Param_Get -PARAM "Strip[2].B1" | Should -Be 1
}
It 'Should set Strip[2].B1 to 0' {
Param_Set -PARAM "Strip[2].B1" -VALUE 0
Param_Get -PARAM "Strip[2].B1" | Should -Be 0
}
}
Context 'Strip[i].B2' {
It 'Should set Strip[0].B2 to 1' {
Param_Set -PARAM "Strip[0].B2" -VALUE 1
Param_Get -PARAM "Strip[0].B2" | Should -Be 1
}
It 'Should set Strip[0].B2 to 0' {
Param_Set -PARAM "Strip[0].B2" -VALUE 0
Param_Get -PARAM "Strip[0].B2" | Should -Be 0
}
It 'Should set Strip[1].B2 to 1' {
Param_Set -PARAM "Strip[1].B2" -VALUE 1
Param_Get -PARAM "Strip[1].B2" | Should -Be 1
}
It 'Should set Strip[1].B2 to 0' {
Param_Set -PARAM "Strip[1].B2" -VALUE 0
Param_Get -PARAM "Strip[1].B2" | Should -Be 0
}
It 'Should set Strip[2].B2 to 1' {
Param_Set -PARAM "Strip[2].B2" -VALUE 1
Param_Get -PARAM "Strip[2].B2" | Should -Be 1
}
It 'Should set Strip[2].B2 to 0' {
Param_Set -PARAM "Strip[2].B2" -VALUE 0
Param_Get -PARAM "Strip[2].B2" | Should -Be 0
}
}
}
Describe 'Set and Get Param String Tests' {
Context 'Strip[i].Label test0' {
It 'Should set Strip[0].Label to test0' {
Param_Set -PARAM "Strip[0].Label" -VALUE 'test0'
Param_Get -PARAM "Strip[0].Label" -IS_STRING $true | Should -Be 'test0'
}
It 'Should set Strip[1].Label to test0' {
Param_Set -PARAM "Strip[1].Label" -VALUE 'test0'
Param_Get -PARAM "Strip[1].Label" -IS_STRING $true | Should -Be 'test0'
}
It 'Should set Strip[2].Label to test0' {
Param_Set -PARAM "Strip[2].Label" -VALUE 'test0'
Param_Get -PARAM "Strip[2].Label" -IS_STRING $true | Should -Be 'test0'
}
}
Context 'Strip[i].Label test1' {
It 'Should set Strip[0].Label to test1' {
Param_Set -PARAM "Strip[0].Label" -VALUE 'test1'
Param_Get -PARAM "Strip[0].Label" -IS_STRING $true | Should -Be 'test1'
}
It 'Should set Strip[1].Label to test1' {
Param_Set -PARAM "Strip[1].Label" -VALUE 'test1'
Param_Get -PARAM "Strip[1].Label" -IS_STRING $true | Should -Be 'test1'
}
It 'Should set Strip[2].Label to test1' {
Param_Set -PARAM "Strip[2].Label" -VALUE 'test1'
Param_Get -PARAM "Strip[2].Label" -IS_STRING $true | Should -Be 'test1'
}
}
Context 'Strip[i].Label test2' {
It 'Should set Strip[0].Label to test2' {
Param_Set -PARAM "Strip[0].Label" -VALUE 'test2'
Param_Get -PARAM "Strip[0].Label" -IS_STRING $true | Should -Be 'test2'
}
It 'Should set Strip[1].Label to test2' {
Param_Set -PARAM "Strip[1].Label" -VALUE 'test2'
Param_Get -PARAM "Strip[1].Label" -IS_STRING $true | Should -Be 'test2'
}
It 'Should set Strip[2].Label to test2' {
Param_Set -PARAM "Strip[2].Label" -VALUE 'test2'
Param_Get -PARAM "Strip[2].Label" -IS_STRING $true | Should -Be 'test2'
Describe 'Set and Get Param String Tests' -ForEach @(
@{ Value = 'test0'; Expected = 'test0' }
@{ Value = 'test1'; Expected = 'test1' }
){
Context 'Strip, one physical one virtual' -ForEach @(
@{ Index = 0 }, @{ Index = 4 }
){
It "Should set Strip[$index].Label to $value" {
Param_Set -PARAM "Strip[$index].Label" -VALUE $value
Param_Get -PARAM "Strip[$index].Label" -IS_STRING $true | Should -Be $value
}
}
}

View File

@ -1,6 +1,5 @@
Param([String]$tag, [Int]$num=1)
Import-Module ..\lib\Voicemeeter.psm1
. ..\lib\base.ps1
Function ParseLog {
Param([String]$logfile)
@ -34,7 +33,7 @@ Function ParseLog {
try
{
$vmr = Get-RemotePotato
$vmr = Get-RemoteBanana
$logfile = "_results.log"
if (Test-Path $logfile) { Clear-Content $logfile }