@Test public void testQueriesAndCleanUp() { final StateLocalInputSUL<Character, Integer> mock = Mockito.spy(sul); Mockito.doAnswer(invocation -> Collections.singleton('a')).when(mock).currentlyEnabledInputs(); final SULSymbolQueryOracle<Character, Integer> oracle = new StateLocalInputSULSymbolQueryOracle<>(mock, example.getUndefinedOutput()); Mockito.verify(mock, Mockito.times(0)).pre(); Mockito.verify(mock, Mockito.times(0)).post(); final Word<Character> i1 = Word.fromCharSequence("abcabcabc"); final Word<Integer> o1 = oracle.answerQuery(i1); oracle.reset(); Assert.assertEquals(o1.firstSymbol(), example.getReferenceAutomaton().computeOutput(i1).firstSymbol()); Assert.assertEquals(o1.subWord(1), Word.fromList(Collections.nCopies(i1.size() - 1, example.getUndefinedOutput()))); Mockito.verify(mock, Mockito.times(1)).pre(); Mockito.verify(mock, Mockito.times(1)).post(); Mockito.verify(mock, Mockito.times(2)).currentlyEnabledInputs(); Mockito.verify(mock, Mockito.times(1)).step(Mockito.anyChar()); final Word<Character> i2 = Word.fromCharSequence("aaaaa"); final Word<Integer> o2 = oracle.answerQuery(i2); oracle.reset(); oracle.reset(); Assert.assertEquals(o2, example.getReferenceAutomaton().computeOutput(i2)); Mockito.verify(mock, Mockito.times(2)).pre(); Mockito.verify(mock, Mockito.times(2)).post(); Mockito.verify(mock, Mockito.times(2 + i2.size())).currentlyEnabledInputs(); Mockito.verify(mock, Mockito.times(1 + i2.size())).step(Mockito.anyChar()); }
@Override public void reset() { super.reset(); this.fetchRequired = true; }
StateLocalInputSULSymbolQueryOracle extends SULSymbolQueryOracle<I, O> implements SymbolQueryOracle<I, O> { @Override public void reset() { super.reset(); this.fetchRequired = true; } }
StateLocalInputSULSymbolQueryOracle extends SULSymbolQueryOracle<I, O> implements SymbolQueryOracle<I, O> { @Override public void reset() { super.reset(); this.fetchRequired = true; } StateLocalInputSULSymbolQueryOracle(StateLocalInputSUL<I, O> sul, O undefinedOutput); }
StateLocalInputSULSymbolQueryOracle extends SULSymbolQueryOracle<I, O> implements SymbolQueryOracle<I, O> { @Override public void reset() { super.reset(); this.fetchRequired = true; } StateLocalInputSULSymbolQueryOracle(StateLocalInputSUL<I, O> sul, O undefinedOutput); @Override void reset(); }
StateLocalInputSULSymbolQueryOracle extends SULSymbolQueryOracle<I, O> implements SymbolQueryOracle<I, O> { @Override public void reset() { super.reset(); this.fetchRequired = true; } StateLocalInputSULSymbolQueryOracle(StateLocalInputSUL<I, O> sul, O undefinedOutput); @Override void reset();  }