-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #207 from Phuire-Research/dx
v0.1.58
- Loading branch information
Showing
15 changed files
with
408 additions
and
6 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
52 changes: 52 additions & 0 deletions
52
src/test/beatSelectorChanges/beatSelectorChanges.concept.ts
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,52 @@ | ||
/*<$ | ||
For the asynchronous graph programming framework Stratimux generate an Experiment Concept that will be used to test deferred changes | ||
accumulated for stage that has a beat and selectors | ||
$>*/ | ||
/*<#*/ | ||
import { beatSelectorChangesAddToCountOneQuality } from './qualities/addToCountOne.quality'; | ||
import { createConcept } from '../../model/concept'; | ||
import { beatSelectorChangesAddToCountTwoQuality } from './qualities/addToCountTwo.quality'; | ||
import { beatSelectorChangesAddToCountThreeQuality } from './qualities/addToCountThree.quality'; | ||
import { beatSelectorChangesAddToCountFourQuality } from './qualities/addToCountFour.quality'; | ||
import { beatSelectorChangesAddToCountFiveQuality } from './qualities/addToCountFive.quality'; | ||
import { beatSelectorChangesAddToCountSixQuality } from './qualities/addToCountSix.quality'; | ||
import { beatSelectorChangesAddToCountSevenQuality } from './qualities/addToCountSeven.quality'; | ||
|
||
export type BeatSelectorChangesState = { | ||
countOne: number | ||
countTwo: number | ||
countThree: number | ||
countFour: number | ||
countFive: number | ||
countSix: number | ||
countSeven: number | ||
} | ||
|
||
export const beatSelectorChangesName = 'beatSelectorChanges'; | ||
|
||
const initialBeatSelectorChangesState: BeatSelectorChangesState = { | ||
countOne: 0, | ||
countTwo: 0, | ||
countThree: 0, | ||
countFour: 0, | ||
countFive: 0, | ||
countSix: 0, | ||
countSeven: 0, | ||
}; | ||
|
||
export const createBeatSelectorChangesConcept = () => { | ||
return createConcept( | ||
beatSelectorChangesName, | ||
initialBeatSelectorChangesState, | ||
[ | ||
beatSelectorChangesAddToCountOneQuality, | ||
beatSelectorChangesAddToCountTwoQuality, | ||
beatSelectorChangesAddToCountThreeQuality, | ||
beatSelectorChangesAddToCountFourQuality, | ||
beatSelectorChangesAddToCountFiveQuality, | ||
beatSelectorChangesAddToCountSixQuality, | ||
beatSelectorChangesAddToCountSevenQuality, | ||
] | ||
); | ||
}; | ||
/*#>*/ |
23 changes: 23 additions & 0 deletions
23
src/test/beatSelectorChanges/beatSelectorChanges.selector.ts
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,23 @@ | ||
/*<$ | ||
For the asynchronous graph programming framework Stratimux and BeatSelectorChanges Concept, | ||
generate a KeyedSelector for the BeatSelectorChanges's count variants state properties. | ||
$>*/ | ||
/*<#*/ | ||
import { KeyedSelector, createConceptKeyedSelector } from '../../model/selector'; | ||
import { BeatSelectorChangesState } from './beatSelectorChanges.concept'; | ||
|
||
export const beatSelectorChangesSelectCountOne: KeyedSelector = | ||
createConceptKeyedSelector<BeatSelectorChangesState>('beatSelectorChanges', 'countOne'); | ||
export const beatSelectorChangesSelectCountTwo: KeyedSelector = | ||
createConceptKeyedSelector<BeatSelectorChangesState>('beatSelectorChanges', 'countTwo'); | ||
export const beatSelectorChangesSelectCountThree: KeyedSelector = | ||
createConceptKeyedSelector<BeatSelectorChangesState>('beatSelectorChanges', 'countThree'); | ||
export const beatSelectorChangesSelectCountFour: KeyedSelector = | ||
createConceptKeyedSelector<BeatSelectorChangesState>('beatSelectorChanges', 'countFour'); | ||
export const beatSelectorChangesSelectCountFive: KeyedSelector = | ||
createConceptKeyedSelector<BeatSelectorChangesState>('beatSelectorChanges', 'countFive'); | ||
export const beatSelectorChangesSelectCountSix: KeyedSelector = | ||
createConceptKeyedSelector<BeatSelectorChangesState>('beatSelectorChanges', 'countSix'); | ||
export const beatSelectorChangesSelectCountSeven: KeyedSelector = | ||
createConceptKeyedSelector<BeatSelectorChangesState>('beatSelectorChanges', 'countSeven'); | ||
/*#>*/ |
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,67 @@ | ||
/*<$ | ||
For the asynchronous graph programming framework Stratimux generate a test that ensures that changes are properly deferred | ||
utilizing the provided BeatSelectorChanges concept | ||
$>*/ | ||
/*<#*/ | ||
import { createAxium, getAxiumState } from '../../model/axium'; | ||
import { createStage } from '../../model/stagePlanner'; | ||
import { generateRandomCountingStrategy } from './strategies/generateCountingStrategy.strategy'; | ||
import { beatSelectorChangesName, createBeatSelectorChangesConcept } from './beatSelectorChanges.concept'; | ||
import { initializeTopic } from '../../concepts/axium/strategies/initialization.strategy'; | ||
import { strategyBegin } from '../../model/actionStrategy'; | ||
import { | ||
beatSelectorChangesSelectCountFive, | ||
beatSelectorChangesSelectCountFour, | ||
beatSelectorChangesSelectCountOne, | ||
beatSelectorChangesSelectCountSeven, | ||
beatSelectorChangesSelectCountSix, | ||
beatSelectorChangesSelectCountThree, | ||
beatSelectorChangesSelectCountTwo | ||
} from './beatSelectorChanges.selector'; | ||
import { selectSlice, selectState } from '../../model/selector'; | ||
jest.setTimeout(30000); | ||
test('Deferred Beat Selector Changes Test', (done) => { | ||
const beat = 7000; | ||
const [tally, strategy, topic] = generateRandomCountingStrategy(); | ||
const axium = createAxium('Beat Selector Changes properly defers accumulated changes', [ | ||
createBeatSelectorChangesConcept() | ||
]); | ||
const plan = axium.plan('Prolonged Counting Strategy', [ | ||
createStage((concepts, dispatch) => { | ||
if (getAxiumState(concepts).lastStrategy === initializeTopic) { | ||
dispatch(strategyBegin(strategy), { | ||
iterateStage: true | ||
}); | ||
} | ||
}), | ||
createStage((concepts, _, changes) => { | ||
if (getAxiumState(concepts).lastStrategy === topic) { | ||
expect(selectSlice(concepts, beatSelectorChangesSelectCountOne)).toBe(tally[0]); | ||
expect(selectSlice(concepts, beatSelectorChangesSelectCountTwo)).toBe(tally[1]); | ||
expect(selectSlice(concepts, beatSelectorChangesSelectCountThree)).toBe(tally[2]); | ||
expect(selectSlice(concepts, beatSelectorChangesSelectCountFour)).toBe(tally[3]); | ||
expect(selectSlice(concepts, beatSelectorChangesSelectCountFive)).toBe(tally[4]); | ||
expect(selectSlice(concepts, beatSelectorChangesSelectCountSix)).toBe(tally[5]); | ||
expect(selectSlice(concepts, beatSelectorChangesSelectCountSeven)).toBe(tally[6]); | ||
expect(changes?.length).toBe(tally.length); | ||
setTimeout(() => { | ||
plan.conclude(); | ||
axium.close(); | ||
done(); | ||
}, 500); | ||
} | ||
}, { | ||
beat, | ||
selectors: [ | ||
beatSelectorChangesSelectCountOne, | ||
beatSelectorChangesSelectCountTwo, | ||
beatSelectorChangesSelectCountThree, | ||
beatSelectorChangesSelectCountFour, | ||
beatSelectorChangesSelectCountFive, | ||
beatSelectorChangesSelectCountSix, | ||
beatSelectorChangesSelectCountSeven, | ||
] | ||
}) | ||
]); | ||
}); | ||
/*#>*/ |
24 changes: 24 additions & 0 deletions
24
src/test/beatSelectorChanges/qualities/addToCountFive.quality.ts
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,24 @@ | ||
/*<$ | ||
For the asynchronous graph programming framework Stratimux and BeatSelectorChanges Concept, | ||
generate a quality that will increment the state's countFive by one. | ||
$>*/ | ||
/*<#*/ | ||
import { defaultMethodCreator } from '../../../model/concept'; | ||
import { BeatSelectorChangesState } from '../beatSelectorChanges.concept'; | ||
import { createQualitySet } from '../../../model/quality'; | ||
|
||
export const [ | ||
beatSelectorChangesAddToCountFive, | ||
beatSelectorChangesAddToCountFiveType, | ||
beatSelectorChangesAddToCountFiveQuality | ||
] = createQualitySet({ | ||
type: 'BeatSelectorChanges AddToCountFive', | ||
reducer: (state: BeatSelectorChangesState) => { | ||
return { | ||
...state, | ||
countFive: state.countFive + 1 | ||
}; | ||
}, | ||
methodCreator: defaultMethodCreator, | ||
}); | ||
/*#>*/ |
24 changes: 24 additions & 0 deletions
24
src/test/beatSelectorChanges/qualities/addToCountFour.quality.ts
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,24 @@ | ||
/*<$ | ||
For the asynchronous graph programming framework Stratimux and BeatSelectorChanges Concept, | ||
generate a quality that will increment the state's countFour by one. | ||
$>*/ | ||
/*<#*/ | ||
import { defaultMethodCreator } from '../../../model/concept'; | ||
import { BeatSelectorChangesState } from '../beatSelectorChanges.concept'; | ||
import { createQualitySet } from '../../../model/quality'; | ||
|
||
export const [ | ||
beatSelectorChangesAddToCountFour, | ||
beatSelectorChangesAddToCountFourType, | ||
beatSelectorChangesAddToCountFourQuality | ||
] = createQualitySet({ | ||
type: 'BeatSelectorChanges AddToCountFour', | ||
reducer: (state: BeatSelectorChangesState) => { | ||
return { | ||
...state, | ||
countFour: state.countFour + 1 | ||
}; | ||
}, | ||
methodCreator: defaultMethodCreator, | ||
}); | ||
/*#>*/ |
24 changes: 24 additions & 0 deletions
24
src/test/beatSelectorChanges/qualities/addToCountOne.quality.ts
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,24 @@ | ||
/*<$ | ||
For the asynchronous graph programming framework Stratimux and BeatSelectorChanges Concept, | ||
generate a quality that will increment the state's countOne by one. | ||
$>*/ | ||
/*<#*/ | ||
import { defaultMethodCreator } from '../../../model/concept'; | ||
import { BeatSelectorChangesState } from '../beatSelectorChanges.concept'; | ||
import { createQualitySet } from '../../../model/quality'; | ||
|
||
export const [ | ||
beatSelectorChangesAddToCountOne, | ||
beatSelectorChangesAddToCountOneType, | ||
beatSelectorChangesAddToCountOneQuality | ||
] = createQualitySet({ | ||
type: 'BeatSelectorChanges AddToCountOne', | ||
reducer: (state: BeatSelectorChangesState) => { | ||
return { | ||
...state, | ||
countOne: state.countOne + 1 | ||
}; | ||
}, | ||
methodCreator: defaultMethodCreator, | ||
}); | ||
/*#>*/ |
24 changes: 24 additions & 0 deletions
24
src/test/beatSelectorChanges/qualities/addToCountSeven.quality.ts
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,24 @@ | ||
/*<$ | ||
For the asynchronous graph programming framework Stratimux and BeatSelectorChanges Concept, | ||
generate a quality that will increment the state's countSeven by one. | ||
$>*/ | ||
/*<#*/ | ||
import { defaultMethodCreator } from '../../../model/concept'; | ||
import { BeatSelectorChangesState } from '../beatSelectorChanges.concept'; | ||
import { createQualitySet } from '../../../model/quality'; | ||
|
||
export const [ | ||
beatSelectorChangesAddToCountSeven, | ||
beatSelectorChangesAddToCountSevenType, | ||
beatSelectorChangesAddToCountSevenQuality | ||
] = createQualitySet({ | ||
type: 'BeatSelectorChanges AddToCountSeven', | ||
reducer: (state: BeatSelectorChangesState) => { | ||
return { | ||
...state, | ||
countSeven: state.countSeven + 1 | ||
}; | ||
}, | ||
methodCreator: defaultMethodCreator, | ||
}); | ||
/*#>*/ |
24 changes: 24 additions & 0 deletions
24
src/test/beatSelectorChanges/qualities/addToCountSix.quality.ts
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,24 @@ | ||
/*<$ | ||
For the asynchronous graph programming framework Stratimux and BeatSelectorChanges Concept, | ||
generate a quality that will increment the state's countSix by one. | ||
$>*/ | ||
/*<#*/ | ||
import { defaultMethodCreator } from '../../../model/concept'; | ||
import { BeatSelectorChangesState } from '../beatSelectorChanges.concept'; | ||
import { createQualitySet } from '../../../model/quality'; | ||
|
||
export const [ | ||
beatSelectorChangesAddToCountSix, | ||
beatSelectorChangesAddToCountSixType, | ||
beatSelectorChangesAddToCountSixQuality | ||
] = createQualitySet({ | ||
type: 'BeatSelectorChanges AddToCountSix', | ||
reducer: (state: BeatSelectorChangesState) => { | ||
return { | ||
...state, | ||
countSix: state.countSix + 1 | ||
}; | ||
}, | ||
methodCreator: defaultMethodCreator, | ||
}); | ||
/*#>*/ |
Oops, something went wrong.