mirror of
				https://github.com/furyfire/trueskill.git
				synced 2025-11-04 02:02:29 +01:00 
			
		
		
		
	
		
			
	
	
		
			36 lines
		
	
	
		
			752 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
		
		
			
		
	
	
			36 lines
		
	
	
		
			752 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
| 
								 | 
							
								<?php
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								declare(strict_types=1);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								namespace DNW\Skills\Tests;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								use DNW\Skills\HashMap;
							 | 
						||
| 
								 | 
							
								use PHPUnit\Framework\TestCase;
							 | 
						||
| 
								 | 
							
								use PHPUnit\Framework\Attributes\CoversClass;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#[CoversClass(HashMap::class)]
							 | 
						||
| 
								 | 
							
								class HashMapTest extends TestCase
							 | 
						||
| 
								 | 
							
								{
							 | 
						||
| 
								 | 
							
								    public function testHashmap(): void
							 | 
						||
| 
								 | 
							
								    {
							 | 
						||
| 
								 | 
							
								        $h = new HashMap();
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								        $this->assertEquals([], $h->getAllKeys());
							 | 
						||
| 
								 | 
							
								        $this->assertEquals([], $h->getAllValues());
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								        $o1 = new \stdClass();
							 | 
						||
| 
								 | 
							
								        $o2 = new \stdClass();
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								        $h->setValue($o1, 1);
							 | 
						||
| 
								 | 
							
								        $h->setvalue($o2, 2);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								        $this->assertEquals([1, 2], $h->getAllValues());
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								        $this->assertEquals(1, $h->getvalue($o1));
							 | 
						||
| 
								 | 
							
								        $this->assertEquals(2, $h->getvalue($o2));
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								        $this->assertEquals(2, $h->count());
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 | 
							
								}
							 |