Skip to content

Commit

Permalink
int -> BigInt to support more than 32 systems and components
Browse files Browse the repository at this point in the history
  • Loading branch information
denniskaselow committed Jan 18, 2019
1 parent f047651 commit 12e4f11
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
28 changes: 14 additions & 14 deletions test/dartemis/core/aspect_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,56 +11,56 @@ void main() {
test('getAspectForAll with one component', () {
final aspect = Aspect.forAllOf([PooledComponentC]);
expect(aspect.all, componentCBit);
expect(aspect.excluded, 0);
expect(aspect.one, 0);
expect(aspect.excluded, BigInt.zero);
expect(aspect.one, BigInt.zero);
});
test('getAspectForAll with all components', () {
final aspect =
Aspect.forAllOf([ComponentA, ComponentB, PooledComponentC]);
expect(aspect.all, componentABit | componentBBit | componentCBit);
expect(aspect.excluded, 0);
expect(aspect.one, 0);
expect(aspect.excluded, BigInt.zero);
expect(aspect.one, BigInt.zero);
});
test('getAspectForAll with one component, excluding another one', () {
final aspect = Aspect.forAllOf([PooledComponentC])..exclude([ComponentA]);
expect(aspect.all, componentCBit);
expect(aspect.excluded, componentABit);
expect(aspect.one, 0);
expect(aspect.one, BigInt.zero);
});
test('getAspectForAll with one component, excluding another two', () {
final aspect = Aspect.forAllOf([PooledComponentC])
..exclude([ComponentA, ComponentB]);
expect(aspect.all, componentCBit);
expect(aspect.excluded, componentABit | componentBBit);
expect(aspect.one, 0);
expect(aspect.one, BigInt.zero);
});
test('getAspectForAll with one component, and one of two', () {
final aspect = Aspect.forAllOf([PooledComponentC])
..oneOf([ComponentA, ComponentB]);
expect(aspect.all, componentCBit);
expect(aspect.excluded, 0);
expect(aspect.excluded, BigInt.zero);
expect(aspect.one, componentABit | componentBBit);
});
test('getAspectForOne with all components', () {
final aspect =
Aspect.forOneOf([ComponentA, ComponentB, PooledComponentC]);
expect(aspect.all, 0);
expect(aspect.excluded, 0);
expect(aspect.all, BigInt.zero);
expect(aspect.excluded, BigInt.zero);
expect(aspect.one, componentABit | componentBBit | componentCBit);
});
test('getAspectForOne with chaining each component', () {
final aspect = Aspect.forOneOf([ComponentA])
..oneOf([ComponentB])
..oneOf([PooledComponentC]);
expect(aspect.all, 0);
expect(aspect.excluded, 0);
expect(aspect.all, BigInt.zero);
expect(aspect.excluded, BigInt.zero);
expect(aspect.one, componentABit | componentBBit | componentCBit);
});
test('getEmpty()', () {
final aspect = Aspect.empty();
expect(aspect.all, 0);
expect(aspect.excluded, 0);
expect(aspect.one, 0);
expect(aspect.all, BigInt.zero);
expect(aspect.excluded, BigInt.zero);
expect(aspect.one, BigInt.zero);
});
});
}
6 changes: 3 additions & 3 deletions test/dartemis/core/components_setup.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ library components_setup;

import "package:dartemis/dartemis.dart";

const int componentABit = 0x0001;
const int componentBBit = 0x0002;
const int componentCBit = 0x0004;
final BigInt componentABit = BigInt.from(0x0001);
final BigInt componentBBit = BigInt.from(0x0002);
final BigInt componentCBit = BigInt.from(0x0004);

void setUpComponents() {
ComponentTypeManager.getBit(ComponentA);
Expand Down

0 comments on commit 12e4f11

Please sign in to comment.