diff --git a/nal/test/nal7.18.nal b/nal/test/nal7.18.nal index da3c1fa608fd8769b3750a883e71945235269409..8a4d0b5aa24ab7e074728b0aa5c5fc3e04e6444f 100644 --- a/nal/test/nal7.18.nal +++ b/nal/test/nal7.18.nal @@ -1,7 +1,7 @@ '********** inference on tense -<(&/,<(*, $x, key_101) --> hold>,+1) =/> <(*, $x, room_101) --> enter>>. +<(&/,<(*, $x, key_101) --> hold>,+100) =/> <(*, $x, room_101) --> enter>>. <(*, John, key_101) --> hold>. :\: 210 -''outputMustContain('<(*,John,room_101) --> enter>. :\: %1.00;0.81%') +''outputMustContain('<(*,John,room_101) --> enter>. :!95: %1.00;0.81%') 'this one is working, but throws an exception diff --git a/nal/test/nal7.19.nal b/nal/test/nal7.19.nal index a222e18ef3808ddf3611ea4c6d1ee105e8d0d7a1..08ea484184a3d872556898663e20dbbd894527e5 100644 --- a/nal/test/nal7.19.nal +++ b/nal/test/nal7.19.nal @@ -1,5 +1,5 @@ '********** inference on tense -<(&/,<(*, $x, key_101) --> hold>,+1) =/> <(*, $x, room_101) --> enter>>. +<(&/,<(*, $x, key_101) --> hold>,+100) =/> <(*, $x, room_101) --> enter>>. <(*,John,room_101) --> enter>. :|: 15 -''outputMustContain('<(*,John,key_101) --> hold>. :\: %1.00;0.45%') +''outputMustContain('<(*,John,key_101) --> hold>. :!-105: %1.00;0.45%') diff --git a/nal/test/nal7.2.nal b/nal/test/nal7.2.nal index 517e799bb76511877bae1699c42bf9db73c4e69f..929bb1689053b93d461f4bc967110203cbbd18a0 100644 --- a/nal/test/nal7.2.nal +++ b/nal/test/nal7.2.nal @@ -6,5 +6,5 @@ 20 -''outputMustContain('<(*,John,room_101) --> enter>. :/: %1.00;0.81%') +''outputMustContain('<(*,John,room_101) --> enter>. :!5: %1.00;0.81%') diff --git a/nal/test/nal7.3.nal b/nal/test/nal7.3.nal index f3069afb6d320f59141e274a40a393f1884d994f..50e9b50e8ad662f893623c892c83e037cf346a4c 100644 --- a/nal/test/nal7.3.nal +++ b/nal/test/nal7.3.nal @@ -6,5 +6,5 @@ 3 -''outputMustContain('<(*,John,key_101) --> hold>. :\: %1.00;0.45%') +''outputMustContain('<(*,John,key_101) --> hold>. :!-10: %1.00;0.45%') diff --git a/nal/test/nal7.35.nal b/nal/test/nal7.35.nal index fcc3bc4d4acb4595673246779e3e52777e8d7359..929bb1689053b93d461f4bc967110203cbbd18a0 100644 --- a/nal/test/nal7.35.nal +++ b/nal/test/nal7.35.nal @@ -1,10 +1,10 @@ '********** inference on tense - IN: <<(*,John,key_101) --> hold> =/> <(*,John,room_101) --> enter>>. +<<(*,John,key_101) --> hold> =/> <(*,John,room_101) --> enter>>. - IN: <(*,John,key_101) --> hold>. :|: +<(*,John,key_101) --> hold>. :|: 20 -''outputMustContain('<(*,John,room_101) --> enter>. :/: %1.00;0.81%') +''outputMustContain('<(*,John,room_101) --> enter>. :!5: %1.00;0.81%') diff --git a/nal/test/nal7.4.nal b/nal/test/nal7.4.nal index 5a0de91e9e3ab4385dfb29fc4e5f0862b76c4201..8c7287c83deca0fee31d7d77bc1becd7804f6d3f 100644 --- a/nal/test/nal7.4.nal +++ b/nal/test/nal7.4.nal @@ -7,5 +7,4 @@ 10 -''outputMustContain('<<(*,John,room_101) --> enter> =\> (&/,<(*,John,door_101) --> open>,+3)>. :|: %1.00;0.45%') -'adjusted +2 to +3 \ No newline at end of file +''outputMustContain('<<(*,John,room_101) --> enter> =\> (&/,<(*,John,door_101) --> open>,+6)>. :!6: %1.00;0.45%') \ No newline at end of file diff --git a/nal/test/nal7.5.nal b/nal/test/nal7.5.nal index 5575b14246d272d389931c25c2d46b2179cdd353..705b193b1420d63f04d53b4e81fc1c4332e14e26 100644 --- a/nal/test/nal7.5.nal +++ b/nal/test/nal7.5.nal @@ -8,8 +8,8 @@ 10 -''outputMustContain('<(&/,<(*,John,door_101) --> open>,+4) =/> <(*,John,room_101) --> enter>>. :|: %0.00;0.45%') -''outputMustContain('<(&/,<(*,John,door_101) --> open>,+4) </> <(*,John,room_101) --> enter>>. :|: %0.00;0.45%') +''outputMustContain('<(&/,<(*,John,door_101) --> open>,+11) =/> <(*,John,room_101) --> enter>>. :!11: %0.00;0.45%') +''outputMustContain('<(&/,<(*,John,door_101) --> open>,+11) </> <(*,John,room_101) --> enter>>. :!11: %0.00;0.45%') 'adjusted +3 to +4 'original output (1.3.3): diff --git a/nal/test/nal7.6.nal b/nal/test/nal7.6.nal index b2b5ef340cf272bc74aa7d9ebe789bf04f8e98cf..a0fdbf64971b248b32dc8ed9891ba6ad74ccde6f 100644 --- a/nal/test/nal7.6.nal +++ b/nal/test/nal7.6.nal @@ -7,11 +7,11 @@ <John --> (/,enter,_,room_101)>. :|: 20 -''outputMustContain('<<John --> (/,enter,_,room_101)> =\> (&/,<John --> (/,open,_,door_101)>,+3)>. :|: %1.00;0.45%') +''outputMustContain('<<John --> (/,enter,_,room_101)> =\> (&/,<John --> (/,open,_,door_101)>,+6)>. :!6: %1.00;0.45%') 'new: variable introduction also in time: -''outputMustContain('<<$1 --> (/,enter,_,room_101)> =\> (&/,<$1 --> (/,open,_,door_101)>,+3)>. :|: %1.00;0.45%') +''outputMustContain('<<$1 --> (/,enter,_,room_101)> =\> (&/,<$1 --> (/,open,_,door_101)>,+6)>. :!6: %1.00;0.45%') 'adjusted +2 to +3 in both conditions diff --git a/nal/test/nal7.7.nal b/nal/test/nal7.7.nal index 14b1224e02a94a259fff3bc027371f0c524eb7b1..7217212b196a1736b00d3380d73e51c4e70e1e50 100644 --- a/nal/test/nal7.7.nal +++ b/nal/test/nal7.7.nal @@ -13,6 +13,6 @@ 20 -''outputMustContain('<(&/,<(*,John,key_101) --> hold>,+4,<(*,John,door_101) --> open>) =/> <(*,John,room_101) --> enter>>. :|: %1.00;0.45%') +''outputMustContain('<(&|,<(*,John,door_101) --> open>,<(*,John,key_101) --> hold>) =|> <(*,John,room_101) --> enter>>. :!0: %1.00;0.40%') 'changed fomr +2 to +4 due to changes in interval calculations 'this one is working, just throwing exception diff --git a/nal/test/nal7.8.nal b/nal/test/nal7.8.nal index c8db0f37ef9a681e10827a691387fb7dacd5e700..b6f172cd7eb5aa81c723736f7a49c00499f0c93c 100644 --- a/nal/test/nal7.8.nal +++ b/nal/test/nal7.8.nal @@ -9,6 +9,7 @@ <(*,John,key_101) --> hold>? :|: 200 - -''outputMustContain('<John --> (/,hold,_,key_101)>. :\: %0.50;0.95%') - +//revision on events +''outputMustContain('<John --> (/,hold,_,key_101)>. :!0: %0.52;0.95%') +//but also looking at it as separate: +''outputMustContain('<John --> (/,hold,_,key_101)>. :!6: %0.00;0.90%') diff --git a/nal/test/nal7.implication_before.nal b/nal/test/nal7.implication_before.nal deleted file mode 100644 index 3fc67135d3c03f271dd6af750956baa335055fd5..0000000000000000000000000000000000000000 --- a/nal/test/nal7.implication_before.nal +++ /dev/null @@ -1,8 +0,0 @@ -********** -<(^pick,stefan) =/> <stefan --> good>>. -<stefan --> good>! -30 -<stefan --> good>. :|: -30 -''outputMustContain('<(&/,(^pick,stefan),+4) =/> <stefan --> good>>. :\: %0.00;0.48%') -''outputMustContain('<(&/,(^pick,$1),+4) =/> <$1 --> good>>. :\: %0.00;0.48%') diff --git a/nal/test/nal7.vardetach1.nal b/nal/test/nal7.vardetach1.nal new file mode 100644 index 0000000000000000000000000000000000000000..6035ad2a398841789149a994ce44cee5c329cc64 --- /dev/null +++ b/nal/test/nal7.vardetach1.nal @@ -0,0 +1,5 @@ +********** +<(&/,<$1 --> A>,+100) =/> <$1 --> B>>. %1.00;0.90% +<x --> B>. :|: %1.00;0.90% +30 +''outputMustContain('<x --> A>. :!-105: %1.00;0.45%') diff --git a/nal/test/nal7.vardetach2.nal b/nal/test/nal7.vardetach2.nal new file mode 100644 index 0000000000000000000000000000000000000000..4b360c3e3bc35657103f43b7ea01b4487f1a99ca --- /dev/null +++ b/nal/test/nal7.vardetach2.nal @@ -0,0 +1,5 @@ +********** +<(&/,<$1 --> A>,+100) =/> <$1 --> B>>. %1.00;0.90% +<x --> A>. :|: %1.00;0.90% +30 +''outputMustContain('<x --> B>. :!100: %1.00;0.81%') diff --git a/nal/test/nal7.vardetach3.nal b/nal/test/nal7.vardetach3.nal new file mode 100644 index 0000000000000000000000000000000000000000..5c3c929bf9cf9e25e12bcb89e8b5c672d19c2d66 --- /dev/null +++ b/nal/test/nal7.vardetach3.nal @@ -0,0 +1,5 @@ +********** //no interval, should we even support it? +<<$1 --> A> =/> <$1 --> B>>. %1.00;0.90% +<x --> B>. :|: %1.00;0.90% +30 +''outputMustContain('<x --> A>. :!-5: %1.00;0.45%') diff --git a/nal/test/nal7.vardetach4.nal b/nal/test/nal7.vardetach4.nal new file mode 100644 index 0000000000000000000000000000000000000000..04f3ca9618e5b839c960228c21920c4bf2451b7f --- /dev/null +++ b/nal/test/nal7.vardetach4.nal @@ -0,0 +1,5 @@ +********** //no interval, should we even support it? +<<$1 --> A> =/> <$1 --> B>>. %1.00;0.90% +<x --> A>. :|: %1.00;0.90% +30 +''outputMustContain('<x --> B>. :!5: %1.00;0.81%') diff --git a/nars_core/nars/entity/Sentence.java b/nars_core/nars/entity/Sentence.java index b49d13be78d23d5e4e0ad36ce36dc609ecb1ce55..a79eb84de4cad9104d6c9a1c7d3d639863353e94 100644 --- a/nars_core/nars/entity/Sentence.java +++ b/nars_core/nars/entity/Sentence.java @@ -515,12 +515,15 @@ public class Sentence<T extends Term> implements Cloneable, Serializable { Long Int = diffabs; timediff = diff>0 ? "+"+String.valueOf(Int) : "-"+String.valueOf(Int); } - String tenseString = ":"+timediff+":"; //stamp.getTense(t, nar.memory.getDuration()); + if(Parameters.TEST_RUNNING) { + timediff = "!"+String.valueOf(stamp.getOccurrenceTime()); + } + + String tenseString = ":"+timediff+":"; //stamp.getTense(t, nar.memory.getDuration()); if(stamp.getOccurrenceTime() == Stamp.ETERNAL) tenseString=""; - CharSequence stampString = showStamp ? stamp.name() : null; int stringLength = contentName.length() + tenseString.length() + 1 + 1; diff --git a/nars_core/nars/main/Parameters.java b/nars_core/nars/main/Parameters.java index 48dadbb1bbdafed5d3094e33c9444e925f0f70fd..dc7e989a558f2fa08b55f750a103158c6b25f08c 100644 --- a/nars_core/nars/main/Parameters.java +++ b/nars_core/nars/main/Parameters.java @@ -42,6 +42,7 @@ public class Parameters { /** use this for advanced error checking, at the expense of lower performance. it is enabled for unit tests automatically regardless of the value here. */ public static boolean DEBUG = false; + public static boolean TEST_RUNNING = false; /** for thorough bag debugging (slow) */ public static boolean DEBUG_BAG = false; diff --git a/nars_test/nars/core/NALTest.java b/nars_test/nars/core/NALTest.java index 5f305d0b8bf6451a18db37db74a19bb5ce6b7c6d..8f44df78b1b8725b128ccfc749c5b0e77eb397f3 100644 --- a/nars_test/nars/core/NALTest.java +++ b/nars_test/nars/core/NALTest.java @@ -30,6 +30,7 @@ public class NALTest { static { Memory.randomNumber.setSeed(1); Parameters.DEBUG = true; + Parameters.TEST_RUNNING = true; } int minCycles = 1550; //TODO reduce this to one or zero to avoid wasting any extra time during tests diff --git a/nars_test/nars/core/NALTestSome.java b/nars_test/nars/core/NALTestSome.java index c8fb787ffb88a6ca8124e4cba9babf1731c208b3..47bbe1c901e431ca8f2c336520668b4268166f58 100644 --- a/nars_test/nars/core/NALTestSome.java +++ b/nars_test/nars/core/NALTestSome.java @@ -1,55 +1,55 @@ -package nars.core; - -import java.io.File; -import java.util.Collection; -import java.util.LinkedList; -import java.util.List; -import org.junit.runner.RunWith; -import org.junit.runners.Parameterized; - - -/** - * runs a subset of the test cases, selected by the boolean include(filename) function - */ -@RunWith(Parameterized.class) -public class NALTestSome extends NALTest { - - static { - showOutput = true; - showSuccess = showOutput; - showTrace = false; - } - - public static boolean include(String filename) { - //return true; //filename.startsWith("nal6.8.nal"); - return filename.startsWith("nars_multistep_3"); - } - - - @Parameterized.Parameters - public static Collection params() { - List l = new LinkedList(); - - //File folder = new File("nal/ClassicalConditioning"); - File folder = new File("nal/test"); - - for (final File file : folder.listFiles()) { - if (file.getName().equals("README.txt") || file.getName().contains(".png")) - continue; - if (include(file.getName())) - l.add(new Object[] { file.getAbsolutePath() } ); - } - - return l; - } - - public static void main(String[] args) { - org.junit.runner.JUnitCore.runClasses(NALTestSome.class); - } - - public NALTestSome(String scriptPath) { - super(scriptPath);//, true); - - } - -} +package nars.core; + +import java.io.File; +import java.util.Collection; +import java.util.LinkedList; +import java.util.List; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; + + +/** + * runs a subset of the test cases, selected by the boolean include(filename) function + */ +@RunWith(Parameterized.class) +public class NALTestSome extends NALTest { + + static { + showOutput = true; + showSuccess = showOutput; + showTrace = false; + } + + public static boolean include(String filename) { + //return true; //filename.startsWith("nal6.8.nal"); + return filename.startsWith("nal7.18.nal"); + } + + + @Parameterized.Parameters + public static Collection params() { + List l = new LinkedList(); + + //File folder = new File("nal/ClassicalConditioning"); + File folder = new File("nal/test"); + + for (final File file : folder.listFiles()) { + if (file.getName().equals("README.txt") || file.getName().contains(".png")) + continue; + if (include(file.getName())) + l.add(new Object[] { file.getAbsolutePath() } ); + } + + return l; + } + + public static void main(String[] args) { + org.junit.runner.JUnitCore.runClasses(NALTestSome.class); + } + + public NALTestSome(String scriptPath) { + super(scriptPath);//, true); + + } + +}