protected override void OnSaving() { base.OnSaving(); if (Session.IsNewObject(this) && !Updating) { SequenceGenerator.GenerateSequence(this); } }
public void GenerateSequenceExceptionsTest() { Assert.Throws <ArgumentNullException>(() => SequenceGenerator.GenerateSequence(null, "asd", 22, Mock.Of <Func <string, string, string> >())); Assert.Throws <ArgumentNullException>(() => SequenceGenerator.GenerateSequence("f32f", null, 22, Mock.Of <Func <string, string, string> >())); Assert.Throws <ArgumentNullException>(() => SequenceGenerator.GenerateSequence("f32f", "fawffw", 22, null)); Assert.Throws <ArgumentOutOfRangeException>(() => SequenceGenerator.GenerateSequence("f32f", "fawffw", 1, Mock.Of <Func <string, string, string> >())); Assert.DoesNotThrow(() => SequenceGenerator.GenerateSequence("f32f", "fawffw", 2, Mock.Of <Func <string, string, string> >())); }
public void GenerateSequence(StructureType type) { int tcCount = 0; //transforma em grafo/fsm //aplica dfs/hsi //retorna uma lista de TestPlan. listgeneralStructure = sequenceGenerator.GenerateSequence(structureCollection.listGeneralStructure, ref tcCount, type); this.TestCaseCount = tcCount + 1; //soma 1 em função do TestCase geral; }
public void Generator_ForSequence3() { double[] expected = { 1, 2, 2.5, 3.3, 4.05757575757576, 4.87086926018965, 5.70389834408211, 6.55785277425587, 7.42763417076325, 8.31053343902137 }; var seq = SequenceGenerator.GenerateSequence <double>(1, 2, 10, (x1, x2) => x2 + (x1 / x2)); for (int i = 0; i < 10; i++) { Assert.AreEqual(expected[i], seq.ElementAt(i), 0.00000000000001); } }
public void Generator_ForSequence3() { double[] expected = { 1, 2, 2.5, 3.3, 4.05757575757576, 4.87086926018965, 5.70389834408211, 6.55785277425587, 7.42763417076325, 8.31053343902137 }; double [] actual = SequenceGenerator.GenerateSequence(expected.Length, 1.0, 2.0, (x1, x2) => x2 + x1 / x2).ToArray(); for (int i = 0; i < expected.Length; i++) { Assert.AreEqual(expected[i], actual[i], 0.00001); } }
/// <summary> /// Method to get the next task. While we have not surpassed the trial limit we set, we move on to the next trial. /// When we have surpassed the limit, we start a new block by calling the method StartNextBlock(). /// After each task begins, the program should wait for a few seconds (the amount of time can be set in unity) after /// which the sequence will disappear /// </summary> private async void StartNextTask() { // Debug.Log("Current Task number is: " + _currentTaskNumber); // initiate the participantSequence here instead of in Start() since there needs to be a new one every time our // current task changes _participantSequence = new List <int>(); // if our tasks are not yet complete, we create a new sequence and continue if (_currentTaskNumber < numberOfTasks) { sequenceGenerator.GenerateSequence(); Debug.LogFormat("String: {0}", sequenceGenerator.GetSequenceString()); ShowMessage(sequenceGenerator.GetSequenceString()); // right before we start to wait, we set _isPressable to false so our view will not be updated for this time _isPressable = false; // wait for x seconds (saved in variable at the beginning of our code) where UI freezes so the participant // cannot do anything except for memorizing the digits await Task.Delay(sleepieTime * 1000); _isPressable = true; // this will vanish the sequence after the wait is over (after sleepieTime has passed) ShowMessage(""); _stimuliStartTime = Time.realtimeSinceStartup; _currentTaskNumber++; } else { // if (_currentBlockNumber < numberOfBlocks) { // TODO change all press SPACE etc instances to something that can be done in VR! ShowMessage("End of Block. Press SPACE to continue"); } else { // TODO can't we just directly print the end message here instead of putting it in StartNextBlock()? StartNextBlock(); } _isBlockRunning = false; } }
private void GenerateAnswers() { if (_puzzleAnswers.GetElement(answersGenerated) != null) { return; } var doorCode = _doorCodeGenerator.GenerateCode(); _puzzleAnswers.AddElement(doorAnswer, doorCode); var mapSequence = _mapSequenceGenerator.GenerateSequence(); _puzzleAnswers.AddElement(mapAnswer, string.Join(",", mapSequence)); _puzzleAnswers.AddElement(answersGenerated, "yes"); }
public void Generate() { int[] result = sequence.GenerateSequence(sequenceLenght, poolSize, forceDifferentItems, avoidOrderedSequences, avoidRepeatedItems); string chaine = ""; for (int i = 0; i < result.Length; i++) { chaine += result[i].ToString(); if (i != result.Length - 1) { chaine += ", "; } } output.text = chaine; GetApparitionChance(); repeatedItemText.text = "Repeated items : " + sequence.TestRepeatedItems().ToString(); orederedSequencesText.text = "Repeated sequences : " + sequence.TestOrderedSequences().ToString(); }
private void btnGenerate_Click(object sender, EventArgs e) { if (lvGenType.SelectedObjects.Count > 0) { SequenceGenerator seqGen = (SequenceGenerator)lvGenType.SelectedObject; AbstractSequenceGenerator seqGenAbstract = (AbstractSequenceGenerator)seqGen; seqGenAbstract.PickGenerationProgress += SeqGenAbstract_PickGenerationProgress; isPickGeneratorRunningStatus = true; String errMsg = ""; if (!seqGen.AreParametersValueValid(out errMsg)) { MessageBox.Show(errMsg); return; } ButtonAvailabilityWhilePicking(true); DisplayGeneratedSequence(seqGen.GenerateSequence()); } ButtonAvailabilityWhilePicking(false); }
public void Generator_ForSequence2() { int[] expected = { 1, 2, 4, 8, 16, 32, 64, 128, 256, 512 }; CollectionAssert.AreEqual(expected, SequenceGenerator.GenerateSequence(expected.Length, 1, 2, (x1, x2) => 6 * x2 - 8 * x1)); }
public void Generator_ForSequence1() { int[] expected = { 1, 1, 2, 3, 5, 8, 13, 21, 34, 55 }; CollectionAssert.AreEqual(expected, SequenceGenerator.GenerateSequence(expected.Length, 1, 1, (x1, x2) => x1 + x2)); }