update tests

pester tests pass for all kinds
- cast device.sr to int
This commit is contained in:
pblivingston 2025-11-26 17:54:06 -05:00
parent ee85d5ffd8
commit 1e4a2da821
3 changed files with 127 additions and 20 deletions

View File

@ -13,7 +13,7 @@ class Device : IRemote {
hidden $_sr = $($this | Add-Member ScriptProperty 'sr' ` hidden $_sr = $($this | Add-Member ScriptProperty 'sr' `
{ {
$this.Getter('sr') [int]$this.Getter('sr')
} ` } `
{ {
return Write-Warning ("ERROR: $($this.identifier()).sr is read only") return Write-Warning ("ERROR: $($this.identifier()).sr is read only")

View File

@ -251,40 +251,68 @@ Describe -Tag 'higher', -TestName 'All Higher Tests' {
} }
} }
Describe 'Int Tests' -ForEach @( Describe 'Int Tests' {
Context 'Strip, one physical, one virtual' -ForEach @(
@{ Index = $phys_in }, @{ Index = $virt_in } @{ Index = $phys_in }, @{ Index = $virt_in }
) { ) {
Context 'Strip, one physical, one virtual' -Skip:$ifBasic -ForEach @( It "Should set and get Strip[$index].Limit" -Skip:$ifBasic -ForEach @(
@{ Value = 3; Expected = 3 } @{ Value = 3; Expected = 3 }
@{ Value = -6; Expected = -6 } @{ Value = -6; Expected = -6 }
) { ) {
It "Should set Strip[$index].Limit to 3" {
$vmr.strip[$index].limit = $value $vmr.strip[$index].limit = $value
$vmr.strip[$index].limit | Should -Be $expected $vmr.strip[$index].limit | Should -Be $expected
} }
} }
Context 'Vban outstream' { Context 'Strip, physical only' -ForEach @(
Context 'sr' -ForEach @( @{ Index = $phys_in }
@{ Value = 44100; Expected = 44100 }
@{ Value = 48000; Expected = 48000 }
) { ) {
It "Should set vban.outstream[$index].sr to $value" { Context 'Device' {
$vmr.vban.outstream[$index].sr = $value It "Should get Strip[$index].Device.sr" {
$vmr.vban.outstream[$index].sr | Should -Be $expected $vmr.strip[$index].device.sr | Should -BeOfType [int]
}
} }
} }
Context 'channel' -ForEach @( Context 'Bus, physical only' -ForEach @(
@{ Index = $phys_out }
) {
Context 'Device' {
It "Should get Bus[$index].Device.sr" {
$vmr.bus[$index].device.sr | Should -BeOfType [int]
}
}
}
Context 'Bus, virtual only' -ForEach @(
@{ Index = $virt_out }
) {
Context 'Device' -Skip:$ifNotBasic {
It "Should get Bus[$index].Device.sr" {
$vmr.bus[$index].device.sr | Should -BeOfType [int]
}
}
}
Context 'Vban outstream' -ForEach @(
@{ Index = $vban_out }
) {
It "Should set vban.outstream[$index].sr to $value" -ForEach @(
@{ Value = 44100; Expected = 44100 }
@{ Value = 48000; Expected = 48000 }
) {
$vmr.vban.outstream[$index].sr = $value
$vmr.vban.outstream[$index].sr | Should -Be $expected
}
It 'Should set vban.outstream[0].channel to 1' -ForEach @(
@{ Value = 1; Expected = 1 } @{ Value = 1; Expected = 1 }
@{ Value = 2; Expected = 2 } @{ Value = 2; Expected = 2 }
) { ) {
It 'Should set vban.outstream[0].channel to 1' {
$vmr.vban.outstream[$index].channel = $value $vmr.vban.outstream[$index].channel = $value
$vmr.vban.outstream[$index].channel | Should -Be $expected $vmr.vban.outstream[$index].channel | Should -Be $expected
} }
} }
}
Context 'Patch' { Context 'Patch' {
It 'Should set and get Patch.composite[$composite]' -Skip:$ifBasic -ForEach @( It 'Should set and get Patch.composite[$composite]' -Skip:$ifBasic -ForEach @(
@ -341,6 +369,32 @@ Describe -Tag 'higher', -TestName 'All Higher Tests' {
} }
} }
Context 'Strip, physical only' -ForEach @(
@{ Index = $phys_in }
) {
Context 'Device' -ForEach @(
@{ Value = 'testInput' }, @{ Value = '' }
) {
It "Should set Strip[$index].Device.wdm" {
$vmr.strip[$index].device.wdm = $value
Start-Sleep -Milliseconds 800
$vmr.strip[$index].device.name | Should -Be $value
}
It "Should set Strip[$index].Device.ks" {
$vmr.strip[$index].device.ks = $value
Start-Sleep -Milliseconds 800
$vmr.strip[$index].device.name | Should -Be $value
}
It "Should set Strip[$index].Device.mme" {
$vmr.strip[$index].device.mme = $value
Start-Sleep -Milliseconds 800
$vmr.strip[$index].device.name | Should -Be $value
}
}
}
Context 'Bus, one physical, one virtual' -ForEach @( Context 'Bus, one physical, one virtual' -ForEach @(
@{ Index = $phys_out }, @{ Index = $virt_out } @{ Index = $phys_out }, @{ Index = $virt_out }
) { ) {
@ -353,6 +407,58 @@ Describe -Tag 'higher', -TestName 'All Higher Tests' {
} }
} }
Context 'Bus, physical only' -ForEach @(
@{ Index = $phys_out }
) {
Context 'Device' -ForEach @(
@{ Value = 'testOutput' }, @{ Value = '' }
) {
It "Should set Bus[$index].Device.wdm" {
$vmr.bus[$index].device.wdm = $value
Start-Sleep -Milliseconds 800
$vmr.bus[$index].device.name | Should -Be $value
}
It "Should set Bus[$index].Device.ks" {
$vmr.bus[$index].device.ks = $value
Start-Sleep -Milliseconds 800
$vmr.bus[$index].device.name | Should -Be $value
}
It "Should set Bus[$index].Device.mme" {
$vmr.bus[$index].device.mme = $value
Start-Sleep -Milliseconds 800
$vmr.bus[$index].device.name | Should -Be $value
}
}
}
Context 'Bus, virtual only' -ForEach @(
@{ Index = $virt_out }
) {
Context 'Device' -Skip:$ifNotBasic -ForEach @(
@{ Value = 'testOutput' }, @{ Value = '' }
) {
It "Should set Bus[$index].Device.wdm" {
$vmr.bus[$index].device.wdm = $value
Start-Sleep -Milliseconds 800
$vmr.bus[$index].device.name | Should -Be $value
}
It "Should set Bus[$index].Device.ks" {
$vmr.bus[$index].device.ks = $value
Start-Sleep -Milliseconds 800
$vmr.bus[$index].device.name | Should -Be $value
}
It "Should set Bus[$index].Device.mme" {
$vmr.bus[$index].device.mme = $value
Start-Sleep -Milliseconds 800
$vmr.bus[$index].device.name | Should -Be $value
}
}
}
Describe 'Vban' -ForEach @( Describe 'Vban' -ForEach @(
@{ Index = $vban_in } @{ Index = $vban_in }
) { ) {

View File

@ -21,6 +21,7 @@ function main() {
# skip conditions by kind # skip conditions by kind
$ifBasic = $vmr.kind.name -eq 'basic' $ifBasic = $vmr.kind.name -eq 'basic'
$ifNotBasic = $vmr.kind.name -ne 'basic'
$ifNotPotato = $vmr.kind.name -ne 'potato' $ifNotPotato = $vmr.kind.name -ne 'potato'
Invoke-Pester -Tag $tag -PassThru | Out-Null Invoke-Pester -Tag $tag -PassThru | Out-Null