Skip to content

Commit

Permalink
Updated tests
Browse files Browse the repository at this point in the history
  • Loading branch information
programarivm committed Dec 23, 2024
1 parent cf2a549 commit ce7aadc
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions tests/unit/SanSignalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,13 @@ public function e4_d5_exd5_Qxd5()
public function A59()
{
$expectedTime = [ 0.0, 2.5, 0.78, 1.0, 1.32, 1.4, 1.7, 3.53, 3.04, 2.78, 0.0, 1.86, 0.19, 0.89, -2.17, 3.41, 2.05, 2.23 ];
$expectedFreq = [ 0.0, 1.62, 0.5, 1.12, 2.35, 1.23, 1.7, 2.2, 0.7, 3.67, 3.88, 1.2, -0.95, -0.55, -0.72, 0.3, 0.29, 0.3 ];

$A59 = file_get_contents(self::DATA_FOLDER.'/sample/A59.pgn');
$sanSignal = new SanSignal(self::$function, $A59, new Board());

$this->assertEquals($expectedTime, $sanSignal->time);
$this->assertEquals($expectedFreq, $sanSignal->freq);
}

/**
Expand All @@ -58,11 +60,13 @@ public function A59()
public function a3()
{
$expectedTime = [ 0.0, 2.0 ];
$expectedFreq = [ 0.0, 2.0 ];

$movetext = '1.a3';
$sanSignal = new SanSignal(self::$function, $movetext, new Board());

$this->assertEquals($expectedTime, $sanSignal->time);
$this->assertEquals($expectedFreq, $sanSignal->freq);
}

/**
Expand All @@ -71,11 +75,13 @@ public function a3()
public function a4()
{
$expectedTime = [ 0.0, 2.0 ];
$expectedFreq = [ 0.0, 1.5 ];

$movetext = '1.a4';
$sanSignal = new SanSignal(self::$function, $movetext, new Board());

$this->assertEquals($expectedTime, $sanSignal->time);
$this->assertEquals($expectedFreq, $sanSignal->freq);
}

/**
Expand All @@ -84,11 +90,13 @@ public function a4()
public function b4()
{
$expectedTime = [ 0.0, 1.0 ];
$expectedFreq = [ 0.0, 1.0 ];

$movetext = '1.b4';
$sanSignal = new SanSignal(self::$function, $movetext, new Board());

$this->assertEquals($expectedTime, $sanSignal->time);
$this->assertEquals($expectedFreq, $sanSignal->freq);
}

/**
Expand All @@ -97,11 +105,13 @@ public function b4()
public function c4()
{
$expectedTime = [ 0.0, 1.0 ];
$expectedFreq = [ 0.0, 0.67 ];

$movetext = '1.c4';
$sanSignal = new SanSignal(self::$function, $movetext, new Board());

$this->assertEquals($expectedTime, $sanSignal->time);
$this->assertEquals($expectedFreq, $sanSignal->freq);
}

/**
Expand All @@ -110,11 +120,13 @@ public function c4()
public function d4()
{
$expectedTime = [ 0.0, 3.0 ];
$expectedFreq = [ 0.0, 1.62 ];

$movetext = '1.d4';
$sanSignal = new SanSignal(self::$function, $movetext, new Board());

$this->assertEquals($expectedTime, $sanSignal->time);
$this->assertEquals($expectedFreq, $sanSignal->freq);
}

/**
Expand All @@ -123,11 +135,13 @@ public function d4()
public function e4()
{
$expectedTime = [ 0.0, 2.0 ];
$expectedFreq = [ 0.0, 0.73 ];

$movetext = '1.e4';
$sanSignal = new SanSignal(self::$function, $movetext, new Board());

$this->assertEquals($expectedTime, $sanSignal->time);
$this->assertEquals($expectedFreq, $sanSignal->freq);
}

/**
Expand All @@ -136,11 +150,13 @@ public function e4()
public function f4()
{
$expectedTime = [ 0.0, 2.0 ];
$expectedFreq = [ 0.0, 0.64 ];

$movetext = '1.f4';
$sanSignal = new SanSignal(self::$function, $movetext, new Board());

$this->assertEquals($expectedTime, $sanSignal->time);
$this->assertEquals($expectedFreq, $sanSignal->freq);
}

/**
Expand All @@ -149,11 +165,13 @@ public function f4()
public function g4()
{
$expectedTime = [ 0.0, 1.0 ];
$expectedFreq = [ 0.0, 0.91 ];

$movetext = '1.g4';
$sanSignal = new SanSignal(self::$function, $movetext, new Board());

$this->assertEquals($expectedTime, $sanSignal->time);
$this->assertEquals($expectedFreq, $sanSignal->freq);
}

/**
Expand All @@ -162,11 +180,13 @@ public function g4()
public function h4()
{
$expectedTime = [ 0.0, 2.0 ];
$expectedFreq = [ 0.0, 1.6 ];

$movetext = '1.h4';
$sanSignal = new SanSignal(self::$function, $movetext, new Board());

$this->assertEquals($expectedTime, $sanSignal->time);
$this->assertEquals($expectedFreq, $sanSignal->freq);
}

/**
Expand All @@ -175,11 +195,13 @@ public function h4()
public function a4_h5()
{
$expectedTime = [ 0.0, 2.0, -1.0 ];
$expectedFreq = [ 0.0, 1.5, -1.0 ];

$movetext = '1.a4 h5';
$sanSignal = new SanSignal(self::$function, $movetext, new Board());

$this->assertEquals($expectedTime, $sanSignal->time);
$this->assertEquals($expectedFreq, $sanSignal->freq);
}

/**
Expand All @@ -188,11 +210,13 @@ public function a4_h5()
public function a4_a5()
{
$expectedTime = [ 0.0, 2.0, 0.0 ];
$expectedFreq = [ 0.0, 1.5, 0.0 ];

$movetext = '1.a4 a5';
$sanSignal = new SanSignal(self::$function, $movetext, new Board());

$this->assertEquals($expectedTime, $sanSignal->time);
$this->assertEquals($expectedFreq, $sanSignal->freq);
}

/**
Expand All @@ -201,11 +225,13 @@ public function a4_a5()
public function a4_e5()
{
$expectedTime = [ 0.0, 2.0, -2.0 ];
$expectedFreq = [ 0.0, 1.5, -0.62 ];

$movetext = '1.a4 e5';
$sanSignal = new SanSignal(self::$function, $movetext, new Board());

$this->assertEquals($expectedTime, $sanSignal->time);
$this->assertEquals($expectedFreq, $sanSignal->freq);
}

/**
Expand All @@ -214,11 +240,13 @@ public function a4_e5()
public function h4_e5()
{
$expectedTime = [ 0.0, 2.0, -3.0 ];
$expectedFreq = [ 0.0, 1.6, -0.63 ];

$movetext = '1.h4 e5';
$sanSignal = new SanSignal(self::$function, $movetext, new Board());

$this->assertEquals($expectedTime, $sanSignal->time);
$this->assertEquals($expectedFreq, $sanSignal->freq);
}

/**
Expand All @@ -227,13 +255,15 @@ public function h4_e5()
public function a5()
{
$expectedTime = [ 0.0, 4.0 ];
$expectedFreq = [ 0.0, 4.0 ];

$fen = '7k/8/8/8/P7/8/8/7K w - -';
$movetext = '1.a5';
$board = FenToBoardFactory::create($fen);
$sanSignal = new SanSignal(self::$function, $movetext, $board);

$this->assertEquals($expectedTime, $sanSignal->time);
$this->assertEquals($expectedFreq, $sanSignal->freq);
}

/**
Expand All @@ -242,13 +272,15 @@ public function a5()
public function a6()
{
$expectedTime = [ 0.0, 5.0 ];
$expectedFreq = [ 0.0, 5.0 ];

$fen = '7k/8/8/P7/8/8/8/7K w - -';
$movetext = '1.a6';
$board = FenToBoardFactory::create($fen);
$sanSignal = new SanSignal(self::$function, $movetext, $board);

$this->assertEquals($expectedTime, $sanSignal->time);
$this->assertEquals($expectedFreq, $sanSignal->freq);
}

/**
Expand All @@ -257,13 +289,15 @@ public function a6()
public function a7()
{
$expectedTime = [ 0.0, 3.0 ];
$expectedFreq = [ 0.0, 3.0 ];

$fen = '4k3/8/P7/8/8/8/8/4K3 w - -';
$movetext = '1.a7';
$board = FenToBoardFactory::create($fen);
$sanSignal = new SanSignal(self::$function, $movetext, $board);

$this->assertEquals($expectedTime, $sanSignal->time);
$this->assertEquals($expectedFreq, $sanSignal->freq);
}

/**
Expand All @@ -272,13 +306,15 @@ public function a7()
public function b5()
{
$expectedTime = [ 0.0, 4.0 ];
$expectedFreq = [ 0.0, 1.33 ];

$fen = '7k/8/8/8/1P6/8/8/7K w - -';
$movetext = '1.b5';
$board = FenToBoardFactory::create($fen);
$sanSignal = new SanSignal(self::$function, $movetext, $board);

$this->assertEquals($expectedTime, $sanSignal->time);
$this->assertEquals($expectedFreq, $sanSignal->freq);
}

/**
Expand All @@ -287,12 +323,14 @@ public function b5()
public function h7()
{
$expectedTime = [ 0.0, 4.0 ];
$expectedFreq = [ 0.0, 3.2 ];

$fen = '4k3/8/7P/8/8/8/8/4K3 w - -';
$movetext = '1.h7';
$board = FenToBoardFactory::create($fen);
$sanSignal = new SanSignal(self::$function, $movetext, $board);

$this->assertEquals($expectedTime, $sanSignal->time);
$this->assertEquals($expectedFreq, $sanSignal->freq);
}
}

0 comments on commit ce7aadc

Please sign in to comment.