mirror of
https://github.com/onyx-and-iris/voicemeeter-api-powershell.git
synced 2025-01-18 05:10:48 +00:00
add recorder tests
add recorder tests
This commit is contained in:
parent
15bec82ec4
commit
9a42fadd09
241
tests/higher.Tests.ps1
Normal file
241
tests/higher.Tests.ps1
Normal file
@ -0,0 +1,241 @@
|
||||
Describe -Tag 'higher', -TestName 'All Higher Tests' {
|
||||
Describe 'Bool tests' -ForEach @(
|
||||
@{ Value = $true; Expected = $true }
|
||||
@{ Value = $false; Expected = $false }
|
||||
){
|
||||
Context 'Strip, one physical one virtual' -ForEach @(
|
||||
@{ Index = 0 }, @{ Index = 3 }
|
||||
){
|
||||
It "Should set and get Strip[$index].Mute" {
|
||||
$vmr.strip[$index].mute = $value
|
||||
$vmr.strip[$index].mute | Should -Be $expected
|
||||
}
|
||||
|
||||
It "Should set and get Strip[$index].Solo" {
|
||||
$vmr.strip[$index].solo = $value
|
||||
$vmr.strip[$index].solo | Should -Be $expected
|
||||
}
|
||||
|
||||
It "Should set and get Strip[$index].A3" {
|
||||
$vmr.strip[$index].A3 = $value
|
||||
$vmr.strip[$index].A3 | Should -Be $expected
|
||||
}
|
||||
|
||||
It "Should set and get Strip[$index].B2" {
|
||||
$vmr.strip[$index].B2 = $value
|
||||
$vmr.strip[$index].B2 | Should -Be $expected
|
||||
}
|
||||
}
|
||||
|
||||
Context 'Bus, one physical one virtual' -ForEach @(
|
||||
@{ Index = 2 }, @{ Index = 4 }
|
||||
){
|
||||
It "Should set and get Bus[$index].Eq" {
|
||||
$vmr.bus[$index].eq = $value
|
||||
$vmr.bus[$index].eq | Should -Be $expected
|
||||
}
|
||||
|
||||
It "Should set and get Bus[$index].Mono" {
|
||||
$vmr.bus[$index].mono = $value
|
||||
$vmr.bus[$index].mono | Should -Be $expected
|
||||
}
|
||||
|
||||
It "Should set and get Bus[$index].mode_amix" {
|
||||
$vmr.bus[$index].mode_amix = $value
|
||||
$vmr.bus[$index].mode_amix | Should -Be $expected
|
||||
}
|
||||
|
||||
It "Should set and get Bus[$index].mode_centeronly" {
|
||||
$vmr.bus[$index].mode_centeronly = $value
|
||||
$vmr.bus[$index].mode_centeronly | Should -Be $expected
|
||||
}
|
||||
}
|
||||
|
||||
Context 'Macrobutton' -ForEach @(
|
||||
@{ Index = 0 }, @{ Index = 69 }
|
||||
){
|
||||
It "Should set and get macrobutton[$index] State" {
|
||||
$vmr.button[$index].state = $value
|
||||
$vmr.button[$index].state | Should -Be $expected
|
||||
}
|
||||
}
|
||||
|
||||
Context 'Vban instream' -ForEach @(
|
||||
@{ Index = 0 }, @{ Index = 4 }
|
||||
){
|
||||
It "Should set vban.instream[$index].on" {
|
||||
$vmr.vban.instream[$index].on = $value
|
||||
$vmr.vban.instream[$index].on | Should -Be $expected
|
||||
}
|
||||
}
|
||||
|
||||
Context 'Vban outstream' -ForEach @(
|
||||
@{ Index = 3 }, @{ Index = 7 }
|
||||
){
|
||||
It "Should set vban.outstream[$index].on" {
|
||||
$vmr.vban.outstream[$index].on = $value
|
||||
$vmr.vban.outstream[$index].on | Should -Be $expected
|
||||
}
|
||||
}
|
||||
|
||||
Context 'Recorder' {
|
||||
It "Should set and get Recorder.A3" {
|
||||
$vmr.recorder.A3 = $value
|
||||
$vmr.recorder.A3 | Should -Be $expected
|
||||
}
|
||||
|
||||
It "Should set and get Recorder.B1" {
|
||||
$vmr.recorder.B1 = $value
|
||||
$vmr.recorder.B1 | Should -Be $expected
|
||||
}
|
||||
|
||||
It "Should set and get Recorder.loop" {
|
||||
$vmr.recorder.loop = $value
|
||||
}
|
||||
}
|
||||
|
||||
Context 'Command' {
|
||||
It 'Should set command.lock' {
|
||||
$vmr.command.lock = $value
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Describe 'Float Tests' {
|
||||
Describe 'Strip tests' {
|
||||
Context 'one physical, one virtual' -ForEach @(
|
||||
@{ Index = 0 }, @{ Index = 4 }
|
||||
){
|
||||
Context 'gain' -ForEach @(
|
||||
@{ Value = 3.6; Expected = 3.6 }, @{ Value = -8.2; Expected = -8.2 }
|
||||
){
|
||||
It "Should set Strip[$index].Gain to $value" {
|
||||
$vmr.strip[$index].gain = $value
|
||||
$vmr.strip[$index].gain | Should -Be $expected
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Context 'physical only' -ForEach @(
|
||||
@{ Index = 0 }, @{ Index = 1 }
|
||||
){
|
||||
Context 'comp, gate' -ForEach @(
|
||||
@{ Value = 8.3; Expected = 8.3 }, @{ Value = 5.1; Expected = 5.1 }
|
||||
){
|
||||
It "Should set Strip[$index].Comp to $value" {
|
||||
$vmr.strip[$index].comp = $value
|
||||
$vmr.strip[$index].comp | Should -Be $expected
|
||||
}
|
||||
|
||||
It "Should set Strip[$index].Gate to $value" {
|
||||
$vmr.strip[$index].gate = $value
|
||||
$vmr.strip[$index].gate | Should -Be $expected
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Describe 'Bus tests' {
|
||||
Context 'one physical, one virtual' -ForEach @(
|
||||
@{ Index = 0 }, @{ Index = 4 }
|
||||
){
|
||||
Context 'gain' -ForEach @(
|
||||
@{ Value = 5.2; Expected = 5.2 }, @{ Value = -38.2; Expected = -38.2 }
|
||||
){
|
||||
It "Should set Bus[$index].Gain to $value" {
|
||||
$vmr.bus[$index].gain = $value
|
||||
$vmr.bus[$index].gain | Should -Be $expected
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Describe 'Int Tests' -ForEach @(
|
||||
@{ Index = 0 }, @{ Index = 4 }
|
||||
){
|
||||
Context 'Strip, one physical, one virtual' -ForEach @(
|
||||
@{ Value = 3; Expected = 3 }
|
||||
@{ Value = -6; Expected = -6 }
|
||||
){
|
||||
It "Should set Strip[$index].Limit to 3" {
|
||||
$vmr.strip[$index].limit = $value
|
||||
$vmr.strip[$index].limit | Should -Be $expected
|
||||
}
|
||||
}
|
||||
|
||||
Context 'Vban outstream' {
|
||||
Context 'sr' -ForEach @(
|
||||
@{ Value = 44100; Expected = 44100 }
|
||||
@{ Value = 48000; Expected = 48000 }
|
||||
){
|
||||
It "Should set vban.outstream[$index].sr to $value" {
|
||||
$vmr.vban.outstream[$index].sr = $value
|
||||
$vmr.vban.outstream[$index].sr | Should -Be $expected
|
||||
}
|
||||
}
|
||||
|
||||
Context 'channel' -ForEach @(
|
||||
@{ Value = 1; Expected = 1 }
|
||||
@{ Value = 2; Expected = 2 }
|
||||
){
|
||||
It 'Should set vban.outstream[0].channel to 1' {
|
||||
$vmr.vban.outstream[$index].channel = $value
|
||||
$vmr.vban.outstream[$index].channel | Should -Be $expected
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Describe 'String Tests' {
|
||||
Context 'Strip, one physical, one virtual' -ForEach @(
|
||||
@{ Index = 0 }, @{ Index = 4 }
|
||||
){
|
||||
It "Should set Strip[$index].Label" -ForEach @(
|
||||
@{ Value = "test0"; Expected = "test0" }
|
||||
@{ Value = "test1"; Expected = "test1" }
|
||||
){
|
||||
$vmr.strip[$index].label = $value
|
||||
$vmr.strip[$index].label | Should -Be $expected
|
||||
}
|
||||
}
|
||||
|
||||
Context 'Bus, one physical, one virtual' -ForEach @(
|
||||
@{ Index = 0 }, @{ Index = 4 }
|
||||
){
|
||||
It "Should set Bus[$index].Label" -ForEach @(
|
||||
@{ Value = "test0"; Expected = "test0" }
|
||||
@{ Value = "test1"; Expected = "test1" }
|
||||
){
|
||||
$vmr.bus[$index].label = $value
|
||||
$vmr.bus[$index].label | Should -Be $expected
|
||||
}
|
||||
}
|
||||
|
||||
Describe 'Vban' -ForEach @(
|
||||
@{ Index = 0 }, @{ Index = 4 }
|
||||
){
|
||||
Context 'instream' {
|
||||
Context 'ip' -ForEach @(
|
||||
@{ Value = "0.0.0.0"; Expected = "0.0.0.0" }
|
||||
){
|
||||
It "Should set vban.instream[$index].name to $value" {
|
||||
$vmr.vban.instream[$index].ip = $value
|
||||
$vmr.vban.instream[$index].ip | Should -Be $expected
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Context 'outstream' {
|
||||
Context 'ip' -ForEach @(
|
||||
@{ Value = "0.0.0.0"; Expected = "0.0.0.0" }
|
||||
){
|
||||
It "Should set vban.outstream[$index].name to $value" {
|
||||
$vmr.vban.outstream[$index].ip = $value
|
||||
$vmr.vban.outstream[$index].ip | Should -Be $expected
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
55
tests/lower.Tests.ps1
Normal file
55
tests/lower.Tests.ps1
Normal file
@ -0,0 +1,55 @@
|
||||
BeforeAll {
|
||||
. ..\lib\base.ps1
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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 $expected
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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 $expected
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
57
tests/runall.ps1
Normal file
57
tests/runall.ps1
Normal file
@ -0,0 +1,57 @@
|
||||
Param([String]$tag, [Int]$num=1, [switch]$log)
|
||||
Import-Module ..\lib\Voicemeeter.psm1
|
||||
|
||||
Function ParseLog {
|
||||
Param([String]$logfile)
|
||||
$summary_file = "_summary.log"
|
||||
if (Test-Path $summary_file) { Clear-Content $summary_file }
|
||||
|
||||
$PASSED_PATTERN = "^PassedCount\s+:\s(\d+)"
|
||||
$FAILED_PATTERN = "^FailedCount\s+:\s(\d+)"
|
||||
|
||||
$DATA = @{
|
||||
"passed" = 0
|
||||
"failed" = 0
|
||||
}
|
||||
|
||||
ForEach ($line in `
|
||||
$(Get-content -Path "${logfile}")) {
|
||||
if ($line -match $PASSED_PATTERN) {
|
||||
$DATA["passed"] += $Matches[1]
|
||||
}
|
||||
elseif ($line -match $FAILED_PATTERN) {
|
||||
$DATA["failed"] += $Matches[1]
|
||||
}
|
||||
}
|
||||
|
||||
"=========================`n" + `
|
||||
"$num tests run:`n" + `
|
||||
"=========================" | Tee-Object -FilePath $summary_file -Append
|
||||
$DATA | ForEach-Object { $_ } | Tee-Object -FilePath $summary_file -Append
|
||||
}
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
$vmr = Get-RemoteBanana
|
||||
|
||||
$logfile = "_results.log"
|
||||
if (Test-Path $logfile) { Clear-Content $logfile }
|
||||
|
||||
1..$num | ForEach-Object {
|
||||
if ($log) {
|
||||
"Running test $_ of $num" | Tee-Object -FilePath $logfile -Append
|
||||
Invoke-Pester -Tag $tag -PassThru | Tee-Object -FilePath $logfile -Append
|
||||
}
|
||||
else {
|
||||
"Running test $_ of $num"
|
||||
Invoke-Pester -Tag $tag -PassThru
|
||||
}
|
||||
}
|
||||
|
||||
if($log) { Parselog -logfile $logfile }
|
||||
}
|
||||
finally
|
||||
{
|
||||
$vmr.Logout()
|
||||
}
|
Loading…
Reference in New Issue
Block a user