-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Attempts to ressurrect some failing tests.
Adds support for pooling into Entity (not sure about this)
- Loading branch information
Showing
24 changed files
with
167 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
package dust.inspector.data; | ||
|
||
typedef FieldHash = Hash<InspectedField>; | ||
typedef FieldHash = Map<String, InspectedField>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,5 +34,7 @@ class InspectedField | |
} | ||
|
||
public function toString():String | ||
return name | ||
{ | ||
return name; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
package dust.inspector.data; | ||
|
||
typedef TypeHash = IntHash<FieldHash>; | ||
typedef TypeHash = Map<Int, FieldHash>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package dust.pooling; | ||
|
||
import dust.pooling.system.SimplePoolFactory; | ||
import dust.pooling.system.PoolFactory; | ||
import dust.context.Config; | ||
import dust.context.DependentConfig; | ||
|
||
class PoolingConfig implements DependentConfig | ||
{ | ||
@inject public var injector:Injector; | ||
|
||
public function dependencies():Array<Class<Config>> | ||
{ | ||
return []; | ||
} | ||
|
||
public function configure() | ||
{ | ||
injector.mapSingletonOf(PoolFactory, SimplePoolFactory); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package dust.lists; | ||
package dust.pooling.data; | ||
|
||
using Lambda; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package dust.pooling.data; | ||
|
||
interface Pooled | ||
{ | ||
public function release():Void; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package dust.pooling.system; | ||
|
||
import dust.pooling.data.Pool; | ||
|
||
interface PoolFactory | ||
{ | ||
function make<T>(count:Int, factory:Void->T):Pool<T>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package dust.pooling.system; | ||
|
||
import dust.pooling.data.Pool; | ||
|
||
class SimplePoolFactory implements PoolFactory | ||
{ | ||
public function make<T>(count:Int, factory:Void->T):Pool<T> | ||
{ | ||
var pool = new Pool<T>(factory); | ||
pool.populate(count); | ||
return pool; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package dust.pooling; | ||
|
||
import dust.pooling.data.Pool; | ||
import dust.pooling.system.PoolFactory; | ||
import flash.display.Sprite; | ||
import dust.context.Context; | ||
|
||
class PoolingConfigTest | ||
{ | ||
var context:Context; | ||
var factory:PoolFactory; | ||
|
||
function setupContext() | ||
{ | ||
context = new Context() | ||
.configure(PoolingConfig) | ||
.start(new Sprite()); | ||
} | ||
|
||
function makePool():Pool<MockPooledA> | ||
{ | ||
factory = context.injector.getInstance(PoolFactory); | ||
return factory.make(100, MockPooledA.make); | ||
} | ||
|
||
@Test public function sanityTest() | ||
{ | ||
setupContext(); | ||
} | ||
|
||
@Test public function mapsPoolFactory() | ||
{ | ||
setupContext(); | ||
var pool = makePool(); | ||
} | ||
} | ||
|
||
class MockPooledA | ||
{ | ||
public static function make():MockPooledA | ||
{ | ||
return new MockPooledA(); | ||
} | ||
|
||
public function new() {} | ||
} |
5 changes: 3 additions & 2 deletions
5
test/dust/lists/PoolTest.hx → test/dust/pooling/data/PoolTest.hx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters