Skip to content

Commit

Permalink
Fix/unit test coverage (#609)
Browse files Browse the repository at this point in the history
* Adjust config for output of phpunit coverage

* Fix path to CTA WAVE unit tests

* Change path to utils function

* Fix typo in ProgramsTest.php

* Fix CTA WAVE unit tests

* Add unit test output to .gitignore

* Remove generic unit test folder from configuration file for now

* Change target branch for unit test coverage back to development
  • Loading branch information
dsilhavy authored Nov 9, 2022
1 parent 2b82513 commit 310009a
Show file tree
Hide file tree
Showing 8 changed files with 110 additions and 111 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/unit_test_coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
- name: Deploy Results
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: html-reports
folder: unit-test-results
token: ${{ secrets.GITHUB_TOKEN }}
branch: gh-pages
target-folder: unit-tests
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ functional-test-results
validation-test-results
Conformance-Frontend/node_modules
functional-tests/hbbtv/sources
Utils/sessions
Utils/sessions
unit-test-results
4 changes: 2 additions & 2 deletions CTAWAVE/UnitTests/PresentationProfileTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
declare(strict_types=1);
require_once __DIR__.'/../CTAWAVE_SelectionSet.php';
require_once __DIR__.'/../CTAWAVE_PresentationProfile.php';
require_once __DIR__.'/../../../Utils/Load.php';
require_once __DIR__.'/../../Utils/Load.php';

use PHPUnit\Framework\TestCase;

Expand All @@ -28,7 +28,7 @@ public function testCMAFPresentationProfile()
$adapts_count=1;
//The given directory contains a SwSet of video with two tracks conforming to AVC-HD Media profile
// and hence expected to conform to CMFHD presentation profile.
$session_dir="Presention_examples/CMFHD_video/";
$session_dir="./CTAWAVE/UnitTests/Presention_examples/CMFHD_video/";
$adaptation_set_template='Adapt$AS$';
$outfile=fopen("out.txt","w");
$current_period=0;
Expand Down
97 changes: 49 additions & 48 deletions CTAWAVE/UnitTests/ProgramsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,72 +6,73 @@
* and open the template in the editor.
*/
declare(strict_types=1);
require_once __DIR__.'/../CTAWAVE_Programs.php';
require_once __DIR__.'/../CTAWAVE_PresentationProfile.php';
require_once __DIR__.'/../CTAWAVE_SelectionSet.php';
require_once __DIR__.'/../../../Utils/Load.php';
require_once __DIR__ . '/../CTAWAVE_Programs.php';
require_once __DIR__ . '/../CTAWAVE_PresentationProfile.php';
require_once __DIR__ . '/../CTAWAVE_SelectionSet.php';
require_once __DIR__ . '/../../Utils/Load.php';

use PHPUnit\Framework\TestCase;

final class ProgramsTest extends TestCase
{
public function testNoSequentialVideoSwSet()
{
$MediaProfDatabase[0][0][0]="HD";
$MediaProfDatabase[1][0][0]="HD";
$session_dir="Splice_examples/Fail_case";
$adaptation_set_template='Adapt$AS$';
$reprsentation_template = 'Adapt$AS$rep$R$';
$this->assertContains("contained in Sequential Sw Sets', overlap/gap in presenation time (non-sequential) is observed for Sw set",
checkSequentialSwSetAV($session_dir,$MediaProfDatabase, $adaptation_set_template,$reprsentation_template));
$MediaProfDatabase[0][0][0] = "HD";
$MediaProfDatabase[1][0][0] = "HD";
$session_dir = "./CTAWAVE/UnitTests/Splice_examples/Fail_case";
$adaptation_set_template = 'Adapt$AS$';
$representation_template = 'Adapt$AS$rep$R$';
$this->assertStringContainsString("contained in Sequential Sw Sets', overlap/gap in presenation time (non-sequential) is observed for Sw set",
checkSequentialSwSetAV($session_dir, $MediaProfDatabase, $adaptation_set_template, $representation_template));
}

public function testSequentialVideoSwSet()
{
$MediaProfDatabase[0][0][0]="HD";
$MediaProfDatabase[1][0][0]="HD";
$session_dir="Splice_examples/Pass_case";
$adaptation_set_template='Adapt$AS$';
$reprsentation_template = 'Adapt$AS$rep$R$';
$this->assertNotContains("contained in Sequential Sw Sets', overlap/gap in presenation time (non-sequential) is observed for Sw set",
checkSequentialSwSetAV($session_dir,$MediaProfDatabase, $adaptation_set_template,$reprsentation_template));
$MediaProfDatabase[0][0][0] = "HD";
$MediaProfDatabase[1][0][0] = "HD";
$session_dir = "./CTAWAVE/UnitTests/Splice_examples/Pass_case";
$adaptation_set_template = 'Adapt$AS$';
$representation_template = 'Adapt$AS$rep$R$';
$this->assertStringNotContainsString("contained in Sequential Sw Sets', overlap/gap in presenation time (non-sequential) is observed for Sw set",
checkSequentialSwSetAV($session_dir, $MediaProfDatabase, $adaptation_set_template, $representation_template));
}

public function testCMFHDBaselineFailWAVEBaseline()
{
$MediaProfDatabase[0][0][0]="HD";
$MediaProfDatabase[1][0][0]="HD";
$session_dir="Splice_examples/Fail_case";
$adaptation_set_template='Adapt$AS$';
$reprsentation_template = 'Adapt$AS$rep$R$';
$spliceConstraitsLog="SampleErrorLog";
$this->assertContains("contain splices conforming to WAVE Baseline Splice profile (section 7.2)', but violation observed in WAVE Baseline",
checkCMFHDBaselineConstraints($MediaProfDatabase, $session_dir,$adaptation_set_template,$spliceConstraitsLog));
$MediaProfDatabase[0][0][0] = "HD";
$MediaProfDatabase[1][0][0] = "HD";
$session_dir = "./CTAWAVE/UnitTests/Splice_examples/Fail_case";
$adaptation_set_template = 'Adapt$AS$';
$representation_template = 'Adapt$AS$rep$R$';
$spliceConstraitsLog = "SampleErrorLog";
$this->assertStringContainsString("contain splices conforming to WAVE Baseline Splice profile (section 7.2)', but violation observed in WAVE Baseline",
checkCMFHDBaselineConstraints($MediaProfDatabase, $session_dir, $adaptation_set_template, $spliceConstraitsLog));
}

public function testCMFHDBaselineFailCMFHDPresentation()
{
$MediaProfDatabase[0][0][0]="HD";
$MediaProfDatabase[1][0][0]="HD";
$session_dir="Splice_examples/Fail_case";
$adaptation_set_template='Adapt$AS$';
$reprsentation_template = 'Adapt$AS$rep$R$';
$spliceConstraitsLog="SampleErrorLog";
$this->assertContains("more CMAF Presentations conforming to CMAF CMFHD profile', violated as not all CMAF presentations conforms to CMFHD",
checkCMFHDBaselineConstraints($MediaProfDatabase, $session_dir,$adaptation_set_template,$spliceConstraitsLog));
$MediaProfDatabase[0][0][0] = "HD";
$MediaProfDatabase[1][0][0] = "HD";
$session_dir = "./CTAWAVE/UnitTests/Splice_examples/Fail_case";
$adaptation_set_template = 'Adapt$AS$';
$representation_template = 'Adapt$AS$rep$R$';
$spliceConstraitsLog = "SampleErrorLog";
$this->assertStringContainsString("more CMAF Presentations conforming to CMAF CMFHD profile', violated as not all CMAF presentations conforms to CMFHD",
checkCMFHDBaselineConstraints($MediaProfDatabase, $session_dir, $adaptation_set_template, $spliceConstraitsLog));
}

public function testCMFHDBaselinePass()
{
$MediaProfDatabase[0][0][0]="HD";
$MediaProfDatabase[1][0][0]="HD";
$session_dir="Splice_examples/CMFHDBaseline";
$adaptation_set_template='Adapt$AS$';
$reprsentation_template = 'Adapt$AS$rep$R$';
$spliceConstraitsLog="SampleNoErrorLog";
$this->assertNotContains("more CMAF Presentations conforming to CMAF CMFHD profile', violated as not all CMAF presentations conforms to CMFHD",
checkCMFHDBaselineConstraints($MediaProfDatabase, $session_dir,$adaptation_set_template,$spliceConstraitsLog));
$this->assertNotContains("contain splices conforming to WAVE Baseline Splice profile (section 7.2)', but violation observed in WAVE Baseline",
checkCMFHDBaselineConstraints($MediaProfDatabase, $session_dir,$adaptation_set_template,$spliceConstraitsLog));
$MediaProfDatabase[0][0][0] = "HD";
$MediaProfDatabase[1][0][0] = "HD";
$session_dir = "./CTAWAVE/UnitTests/Splice_examples/CMFHDBaseline";
$adaptation_set_template = 'Adapt$AS$';
$representation_template = 'Adapt$AS$rep$R$';
$spliceConstraitsLog = "SampleNoErrorLog";
$this->assertStringNotContainsString("more CMAF Presentations conforming to CMAF CMFHD profile', violated as not all CMAF presentations conforms to CMFHD",
checkCMFHDBaselineConstraints($MediaProfDatabase, $session_dir, $adaptation_set_template, $spliceConstraitsLog));
$this->assertStringNotContainsString("contain splices conforming to WAVE Baseline Splice profile (section 7.2)', but violation observed in WAVE Baseline",
checkCMFHDBaselineConstraints($MediaProfDatabase, $session_dir, $adaptation_set_template, $spliceConstraitsLog));
}

}
22 changes: 11 additions & 11 deletions CTAWAVE/UnitTests/SelectionSetTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

declare(strict_types=1);
require_once __DIR__.'/../CTAWAVE_SelectionSet.php';
require_once __DIR__.'/../../../Utils/Load.php';
require_once __DIR__.'/../../Utils/Load.php';

use PHPUnit\Framework\TestCase;

Expand All @@ -26,47 +26,47 @@ final class SelectionSetTest extends TestCase
public function testNoWAVETracksInSelSet()
{
$adapts_count=1;
$session_dir="Selection_set_examples/SelSetVideoNoWaveTracks";
$session_dir="./CTAWAVE/UnitTests/Selection_set_examples/SelSetVideoNoWaveTracks";
$adaptation_set_template='Adapt$AS$';
$outfile=fopen("out.txt","w");
$current_period=0;
$this->assertContains("no Tracks found conforming to WAVE", CTACheckSelectionSet($adapts_count,$session_dir,$adaptation_set_template,$outfile,$current_period));
$this->assertStringContainsString("no Tracks found conforming to WAVE", CTACheckSelectionSet($adapts_count,$session_dir,$adaptation_set_template,$outfile,$current_period));
}
//Test that no WAVE SwSet found in the SelSet. SwSet contains one WAVE track and one non-WAVE track.
public function testNoWAVESwSetInSelSet()
{
$adapts_count=1;
$session_dir="Selection_set_examples/SelSetVideoNoWaveSwSet";
$session_dir="./CTAWAVE/UnitTests/Selection_set_examples/SelSetVideoNoWaveSwSet";
$adaptation_set_template='Adapt$AS$';
$outfile=fopen("out.txt","w");
$current_period=0;
$this->assertContains("no Switching Set found conforming to WAVE", CTACheckSelectionSet($adapts_count,$session_dir,$adaptation_set_template,$outfile,$current_period));
$this->assertStringContainsString("no Switching Set found conforming to WAVE", CTACheckSelectionSet($adapts_count,$session_dir,$adaptation_set_template,$outfile,$current_period));
}
//

//Test that a WAVE SwSet is found in the SelSet. The SwSet contains two Wave tracks.
public function testWAVESwSetInSelSet()
{
$adapts_count=1;
$session_dir="Selection_set_examples/SelSetVideoWaveSwSet";
$session_dir="./CTAWAVE/UnitTests/Selection_set_examples/SelSetVideoWaveSwSet";
$adaptation_set_template='Adapt$AS$';
$outfile=fopen("out.txt","w");
$current_period=0;
$this->assertNotContains("no Switching Set found conforming to WAVE", CTACheckSelectionSet($adapts_count,$session_dir,$adaptation_set_template,$outfile,$current_period));
$this->assertStringNotContainsString("no Switching Set found conforming to WAVE", CTACheckSelectionSet($adapts_count,$session_dir,$adaptation_set_template,$outfile,$current_period));
}

public function testSingleInitSwSet()
{
$adapts_count=1;
$session_dir="Selection_set_examples/SwSetSingleInit";
$session_dir="./CTAWAVE/UnitTests/Selection_set_examples/SwSetSingleInit";
$adaptation_set_template='Adapt$AS$';
$this->assertContains("reinitialization not req on Track switches', and found CMAF common header", CTACheckSingleInitSwSet($adapts_count,$session_dir,$adaptation_set_template));
$this->assertStringContainsString("reinitialization not req on Track switches', and found CMAF common header", CTACheckSingleInitSwSet($adapts_count,$session_dir,$adaptation_set_template));
}
public function testNoSingleInitSwSet()
{
$adapts_count=1;
$session_dir="Selection_set_examples/SelSetVideoWaveSwSet";
$session_dir="./CTAWAVE/UnitTests/Selection_set_examples/SelSetVideoWaveSwSet";
$adaptation_set_template='Adapt$AS$';
$this->assertNotContains("reinitialization not req on Track switches', and found CMAF common header", CTACheckSingleInitSwSet($adapts_count,$session_dir,$adaptation_set_template));
$this->assertStringNotContainsString("reinitialization not req on Track switches', and found CMAF common header", CTACheckSingleInitSwSet($adapts_count,$session_dir,$adaptation_set_template));
}
}
Loading

0 comments on commit 310009a

Please sign in to comment.