2024-02-01 10:50:18 +00:00
|
|
|
<?php
|
|
|
|
|
2024-02-02 14:53:38 +00:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
2024-02-01 10:50:18 +00:00
|
|
|
namespace DNW\Skills\Tests\FactorGraphs;
|
|
|
|
|
|
|
|
use DNW\Skills\FactorGraphs\Variable;
|
|
|
|
use DNW\Skills\Numerics\GaussianDistribution;
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
|
|
|
|
class VariableTest extends TestCase
|
|
|
|
{
|
2024-03-01 12:56:55 +00:00
|
|
|
public function testGetterSetter(): void
|
2024-02-01 10:50:18 +00:00
|
|
|
{
|
|
|
|
$gd_prior = new GaussianDistribution();
|
2024-03-19 15:09:13 +00:00
|
|
|
$var = new Variable($gd_prior);
|
2024-02-01 10:50:18 +00:00
|
|
|
$this->assertEquals($gd_prior, $var->getValue());
|
2024-02-02 14:53:38 +00:00
|
|
|
|
2024-02-01 10:50:18 +00:00
|
|
|
$gd_new = new GaussianDistribution();
|
|
|
|
$this->assertEquals($gd_new, $var->getValue());
|
|
|
|
$var->resetToPrior();
|
|
|
|
$this->assertEquals($gd_prior, $var->getValue());
|
|
|
|
}
|
|
|
|
}
|