Updated output, added verify_output.py
This commit is contained in:
parent
45133a4945
commit
e84910951c
@ -21,8 +21,8 @@ public class AtUnitComposition {
|
|||||||
}
|
}
|
||||||
/* Output:
|
/* Output:
|
||||||
annotations.AtUnitComposition
|
annotations.AtUnitComposition
|
||||||
|
. _methodOne
|
||||||
. _methodTwo This is methodTwo
|
. _methodTwo This is methodTwo
|
||||||
|
|
||||||
. _methodOne
|
|
||||||
OK (2 tests)
|
OK (2 tests)
|
||||||
*/
|
*/
|
||||||
|
@ -39,11 +39,11 @@ annotations.AtUnitExample2
|
|||||||
surprise!
|
surprise!
|
||||||
(failed)
|
(failed)
|
||||||
. assertExample
|
. assertExample
|
||||||
. assertAndReturn This is methodTwo
|
|
||||||
|
|
||||||
. exceptionExample java.io.FileNotFoundException:
|
. exceptionExample java.io.FileNotFoundException:
|
||||||
nofile.txt (The system cannot find the file specified)
|
nofile.txt (The system cannot find the file specified)
|
||||||
(failed)
|
(failed)
|
||||||
|
. assertAndReturn This is methodTwo
|
||||||
|
|
||||||
(4 tests)
|
(4 tests)
|
||||||
|
|
||||||
>>> 2 FAILURES <<<
|
>>> 2 FAILURES <<<
|
||||||
|
@ -30,9 +30,9 @@ public class AtUnitExample3 {
|
|||||||
}
|
}
|
||||||
/* Output:
|
/* Output:
|
||||||
annotations.AtUnitExample3
|
annotations.AtUnitExample3
|
||||||
. initialization
|
|
||||||
. methodOneTest
|
|
||||||
. m2 This is methodTwo
|
. m2 This is methodTwo
|
||||||
|
|
||||||
|
. methodOneTest
|
||||||
|
. initialization
|
||||||
OK (3 tests)
|
OK (3 tests)
|
||||||
*/
|
*/
|
||||||
|
@ -46,10 +46,10 @@ public class AtUnitExample5 {
|
|||||||
/* Output:
|
/* Output:
|
||||||
annotations.AtUnitExample5
|
annotations.AtUnitExample5
|
||||||
. test1
|
. test1
|
||||||
Running cleanup
|
|
||||||
. test2
|
|
||||||
Running cleanup
|
Running cleanup
|
||||||
. test3
|
. test3
|
||||||
|
Running cleanup
|
||||||
|
. test2
|
||||||
Running cleanup
|
Running cleanup
|
||||||
OK (3 tests)
|
OK (3 tests)
|
||||||
*/
|
*/
|
||||||
|
@ -17,8 +17,8 @@ public class AtUnitExternalTest extends AtUnitExample1 {
|
|||||||
}
|
}
|
||||||
/* Output:
|
/* Output:
|
||||||
annotations.AtUnitExternalTest
|
annotations.AtUnitExternalTest
|
||||||
. _methodOne
|
|
||||||
. _methodTwo This is methodTwo
|
. _methodTwo This is methodTwo
|
||||||
|
|
||||||
|
. _methodOne
|
||||||
OK (2 tests)
|
OK (2 tests)
|
||||||
*/
|
*/
|
||||||
|
@ -27,7 +27,7 @@ public class HashSetTest {
|
|||||||
/* Output:
|
/* Output:
|
||||||
annotations.HashSetTest
|
annotations.HashSetTest
|
||||||
. _remove
|
. _remove
|
||||||
. initialization
|
|
||||||
. _contains
|
. _contains
|
||||||
|
. initialization
|
||||||
OK (3 tests)
|
OK (3 tests)
|
||||||
*/
|
*/
|
||||||
|
@ -31,8 +31,8 @@ public class StackLStringTest extends StackL<String> {
|
|||||||
}
|
}
|
||||||
/* Output:
|
/* Output:
|
||||||
annotations.StackLStringTest
|
annotations.StackLStringTest
|
||||||
. _push
|
|
||||||
. _top
|
|
||||||
. _pop
|
. _pop
|
||||||
|
. _top
|
||||||
|
. _push
|
||||||
OK (3 tests)
|
OK (3 tests)
|
||||||
*/
|
*/
|
||||||
|
@ -16,6 +16,6 @@ public class BadMicroBenchmark {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Output:
|
/* Output:
|
||||||
setAll: 62
|
setAll: 75
|
||||||
parallelSetAll: 75
|
parallelSetAll: 110
|
||||||
*/
|
*/
|
||||||
|
@ -17,6 +17,6 @@ public class BadMicroBenchmark2 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Output:
|
/* Output:
|
||||||
parallelSetAll: 83
|
parallelSetAll: 68
|
||||||
setAll: 159
|
setAll: 196
|
||||||
*/
|
*/
|
||||||
|
@ -27,8 +27,8 @@ public class BadMicroBenchmark3 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Output:
|
/* Output:
|
||||||
parallelSetAll: 4948
|
parallelSetAll: 4540
|
||||||
setAll: 1204
|
setAll: 1540
|
||||||
parallelSetAll: 405
|
parallelSetAll: 398
|
||||||
setAll: 557
|
setAll: 739
|
||||||
*/
|
*/
|
||||||
|
@ -20,7 +20,7 @@ public class ParallelSort {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Output:
|
/* Output:
|
||||||
sort(): 864
|
sort(): 1237
|
||||||
parallelSort(): 274
|
parallelSort(): 344
|
||||||
3
|
3
|
||||||
*/
|
*/
|
||||||
|
@ -195,17 +195,17 @@ public class ListPerformance {
|
|||||||
/* Output:
|
/* Output:
|
||||||
--- Array as List ---
|
--- Array as List ---
|
||||||
size get set
|
size get set
|
||||||
100 44 44
|
100 50 68
|
||||||
--------------------- ArrayList ---------------------
|
--------------------- ArrayList ---------------------
|
||||||
size add get set iteradd insert remove
|
size add get set iteradd insert remove
|
||||||
100 80 44 48 106 0 640
|
100 60 76 74 103 0 360
|
||||||
--------------------- LinkedList ---------------------
|
--------------------- LinkedList ---------------------
|
||||||
size add get set iteradd insert remove
|
size add get set iteradd insert remove
|
||||||
100 80 106 94 177 0 120
|
100 200 166 114 201 0 120
|
||||||
----------------------- Vector -----------------------
|
----------------------- Vector -----------------------
|
||||||
size add get set iteradd insert remove
|
size add get set iteradd insert remove
|
||||||
100 40 62 58 114 0 120
|
100 60 76 84 159 0 220
|
||||||
-------------------- Queue tests --------------------
|
-------------------- Queue tests --------------------
|
||||||
size addFirst addLast rmFirst rmLast
|
size addFirst addLast rmFirst rmLast
|
||||||
100 60 120 120 100
|
100 80 160 100 120
|
||||||
*/
|
*/
|
||||||
|
@ -63,20 +63,20 @@ public class MapPerformance {
|
|||||||
/* Output:
|
/* Output:
|
||||||
---------- TreeMap ----------
|
---------- TreeMap ----------
|
||||||
size put get iterate
|
size put get iterate
|
||||||
100 228 128 25
|
100 286 152 35
|
||||||
---------- HashMap ----------
|
---------- HashMap ----------
|
||||||
size put get iterate
|
size put get iterate
|
||||||
100 68 26 35
|
100 86 38 44
|
||||||
------- LinkedHashMap -------
|
------- LinkedHashMap -------
|
||||||
size put get iterate
|
size put get iterate
|
||||||
100 70 35 18
|
100 92 27 28
|
||||||
------ IdentityHashMap ------
|
------ IdentityHashMap ------
|
||||||
size put get iterate
|
size put get iterate
|
||||||
100 128 126 38
|
100 298 101 42
|
||||||
-------- WeakHashMap --------
|
-------- WeakHashMap --------
|
||||||
size put get iterate
|
size put get iterate
|
||||||
100 62 31 25
|
100 88 36 57
|
||||||
--------- Hashtable ---------
|
--------- Hashtable ---------
|
||||||
size put get iterate
|
size put get iterate
|
||||||
100 56 30 20
|
100 98 52 46
|
||||||
*/
|
*/
|
||||||
|
@ -60,11 +60,11 @@ public class SetPerformance {
|
|||||||
/* Output:
|
/* Output:
|
||||||
------------- TreeSet -------------
|
------------- TreeSet -------------
|
||||||
size add contains iterate
|
size add contains iterate
|
||||||
100 200 132 24
|
100 256 162 31
|
||||||
------------- HashSet -------------
|
------------- HashSet -------------
|
||||||
size add contains iterate
|
size add contains iterate
|
||||||
100 76 32 34
|
100 88 58 43
|
||||||
---------- LinkedHashSet ----------
|
---------- LinkedHashSet ----------
|
||||||
size add contains iterate
|
size add contains iterate
|
||||||
100 70 25 19
|
100 100 46 23
|
||||||
*/
|
*/
|
||||||
|
@ -32,8 +32,8 @@ public enum ConstantSpecificMethod {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Output:
|
/* Output:
|
||||||
Jul 22, 2016
|
Jul 27, 2016
|
||||||
C:\Users\Bruce\Documents\GitHub\on-
|
C:\Users\Bruce\Documents\GitHub\on-
|
||||||
java\ExtractedExamples\\gradle\wrapper\gradle-wrapper.jar
|
java\ExtractedExamples\\gradle\wrapper\gradle-wrapper.jar
|
||||||
1.8.0_77
|
1.8.0_102
|
||||||
*/
|
*/
|
||||||
|
@ -33,13 +33,13 @@ public class LoggingExceptions {
|
|||||||
}
|
}
|
||||||
/* Output:
|
/* Output:
|
||||||
___[ Error Output ]___
|
___[ Error Output ]___
|
||||||
Jul 22, 2016 11:55:45 AM LoggingException <init>
|
Jul 27, 2016 10:50:30 AM LoggingException <init>
|
||||||
SEVERE: LoggingException
|
SEVERE: LoggingException
|
||||||
at
|
at
|
||||||
LoggingExceptions.main(LoggingExceptions.java:20)
|
LoggingExceptions.main(LoggingExceptions.java:20)
|
||||||
|
|
||||||
Caught LoggingException
|
Caught LoggingException
|
||||||
Jul 22, 2016 11:55:45 AM LoggingException <init>
|
Jul 27, 2016 10:50:30 AM LoggingException <init>
|
||||||
SEVERE: LoggingException
|
SEVERE: LoggingException
|
||||||
at
|
at
|
||||||
LoggingExceptions.main(LoggingExceptions.java:25)
|
LoggingExceptions.main(LoggingExceptions.java:25)
|
||||||
|
@ -25,7 +25,7 @@ public class LoggingExceptions2 {
|
|||||||
}
|
}
|
||||||
/* Output:
|
/* Output:
|
||||||
___[ Error Output ]___
|
___[ Error Output ]___
|
||||||
Jul 22, 2016 11:55:47 AM LoggingExceptions2 logException
|
Jul 27, 2016 10:50:30 AM LoggingExceptions2 logException
|
||||||
SEVERE: java.lang.NullPointerException
|
SEVERE: java.lang.NullPointerException
|
||||||
at
|
at
|
||||||
LoggingExceptions2.main(LoggingExceptions2.java:17)
|
LoggingExceptions2.main(LoggingExceptions2.java:17)
|
||||||
|
@ -59,7 +59,7 @@ Nope, that doesn't work.
|
|||||||
test\bag
|
test\bag
|
||||||
test\bar
|
test\bar
|
||||||
test\baz
|
test\baz
|
||||||
test\DIR_8460303386746117268
|
test\DIR_3697011820450773773
|
||||||
test\foo
|
test\foo
|
||||||
test\Hello.txt
|
test\Hello.txt
|
||||||
*********
|
*********
|
||||||
@ -68,27 +68,27 @@ test\bag
|
|||||||
test\bag\foo
|
test\bag\foo
|
||||||
test\bag\foo\bar
|
test\bag\foo\bar
|
||||||
test\bag\foo\bar\baz
|
test\bag\foo\bar\baz
|
||||||
test\bag\foo\bar\baz\4101434906493986662.tmp
|
test\bag\foo\bar\baz\234245189903117886.tmp
|
||||||
test\bag\foo\bar\baz\File.txt
|
test\bag\foo\bar\baz\File.txt
|
||||||
test\bar
|
test\bar
|
||||||
test\bar\baz
|
test\bar\baz
|
||||||
test\bar\baz\bag
|
test\bar\baz\bag
|
||||||
test\bar\baz\bag\foo
|
test\bar\baz\bag\foo
|
||||||
test\bar\baz\bag\foo\7816199470809856557.tmp
|
test\bar\baz\bag\foo\8752987828022262887.tmp
|
||||||
test\bar\baz\bag\foo\File.txt
|
test\bar\baz\bag\foo\File.txt
|
||||||
test\baz
|
test\baz
|
||||||
test\baz\bag
|
test\baz\bag
|
||||||
test\baz\bag\foo
|
test\baz\bag\foo
|
||||||
test\baz\bag\foo\bar
|
test\baz\bag\foo\bar
|
||||||
test\baz\bag\foo\bar\5361615738906181780.tmp
|
test\baz\bag\foo\bar\465343347528104633.tmp
|
||||||
test\baz\bag\foo\bar\File.txt
|
test\baz\bag\foo\bar\File.txt
|
||||||
test\DIR_8460303386746117268
|
test\DIR_3697011820450773773
|
||||||
test\DIR_8460303386746117268\pre8013004952693214586.non
|
test\DIR_3697011820450773773\pre3304897437567097054.non
|
||||||
test\foo
|
test\foo
|
||||||
test\foo\bar
|
test\foo\bar
|
||||||
test\foo\bar\baz
|
test\foo\bar\baz
|
||||||
test\foo\bar\baz\bag
|
test\foo\bar\baz\bag
|
||||||
test\foo\bar\baz\bag\7164453512868942303.tmp
|
test\foo\bar\baz\bag\2118206626074637804.tmp
|
||||||
test\foo\bar\baz\bag\File.txt
|
test\foo\bar\baz\bag\File.txt
|
||||||
test\Hello.txt
|
test\Hello.txt
|
||||||
*/
|
*/
|
||||||
|
@ -36,24 +36,24 @@ public class Find {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Output:
|
/* Output:
|
||||||
test\bag\foo\bar\baz\6081303161062291208.tmp
|
test\bag\foo\bar\baz\369594599218802549.tmp
|
||||||
test\bag\foo\bar\baz\File.txt
|
test\bag\foo\bar\baz\File.txt
|
||||||
test\bar\baz\bag\foo\771297659941286896.tmp
|
test\bar\baz\bag\foo\2372197258227988384.tmp
|
||||||
test\bar\baz\bag\foo\File.txt
|
test\bar\baz\bag\foo\File.txt
|
||||||
test\baz\bag\foo\bar\1769334171376700049.tmp
|
test\baz\bag\foo\bar\1091363470697614580.tmp
|
||||||
test\baz\bag\foo\bar\File.txt
|
test\baz\bag\foo\bar\File.txt
|
||||||
test\dir.tmp
|
test\dir.tmp
|
||||||
test\foo\bar\baz\bag\4483950466184961816.tmp
|
test\foo\bar\baz\bag\48863440153181406.tmp
|
||||||
test\foo\bar\baz\bag\File.txt
|
test\foo\bar\baz\bag\File.txt
|
||||||
***************
|
***************
|
||||||
6081303161062291208.tmp
|
369594599218802549.tmp
|
||||||
771297659941286896.tmp
|
2372197258227988384.tmp
|
||||||
1769334171376700049.tmp
|
1091363470697614580.tmp
|
||||||
dir.tmp
|
dir.tmp
|
||||||
4483950466184961816.tmp
|
48863440153181406.tmp
|
||||||
***************
|
***************
|
||||||
6081303161062291208.tmp
|
369594599218802549.tmp
|
||||||
771297659941286896.tmp
|
2372197258227988384.tmp
|
||||||
1769334171376700049.tmp
|
1091363470697614580.tmp
|
||||||
4483950466184961816.tmp
|
48863440153181406.tmp
|
||||||
*/
|
*/
|
||||||
|
@ -47,9 +47,9 @@ RegularFile: true
|
|||||||
Writable: true
|
Writable: true
|
||||||
notExists: false
|
notExists: false
|
||||||
Hidden: false
|
Hidden: false
|
||||||
size: 1631
|
size: 1630
|
||||||
FileStore: SSD (C:)
|
FileStore: SSD (C:)
|
||||||
LastModified: : 2016-07-22T17:55:34.80143Z
|
LastModified: : 2016-07-27T15:52:49.898848Z
|
||||||
Owner: MINDVIEWTOSHIBA\Bruce (User)
|
Owner: MINDVIEWTOSHIBA\Bruce (User)
|
||||||
ContentType: null
|
ContentType: null
|
||||||
SymbolicLink: false
|
SymbolicLink: false
|
||||||
|
@ -47,4 +47,7 @@ deleting test\bar\baz\bag\foo\File.txt
|
|||||||
evt.context(): File.txt
|
evt.context(): File.txt
|
||||||
evt.count(): 1
|
evt.count(): 1
|
||||||
evt.kind(): ENTRY_DELETE
|
evt.kind(): ENTRY_DELETE
|
||||||
|
evt.context(): File.txt
|
||||||
|
evt.count(): 1
|
||||||
|
evt.kind(): ENTRY_DELETE
|
||||||
*/
|
*/
|
||||||
|
@ -60,6 +60,6 @@ public class DynamicProxyMixin {
|
|||||||
}
|
}
|
||||||
/* Output:
|
/* Output:
|
||||||
Hello
|
Hello
|
||||||
1469210152348
|
1469638238271
|
||||||
1
|
1
|
||||||
*/
|
*/
|
||||||
|
@ -64,6 +64,6 @@ public class Mixins {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Output:
|
/* Output:
|
||||||
test string 1 1469210158525 1
|
test string 1 1469638250315 1
|
||||||
test string 2 1469210158525 2
|
test string 2 1469638250317 2
|
||||||
*/
|
*/
|
||||||
|
@ -50,52 +50,52 @@ public class ConfigureLogging {
|
|||||||
Logger Name : com.mindviewinc.test Level: FINER
|
Logger Name : com.mindviewinc.test Level: FINER
|
||||||
Logger Name : random Level: SEVERE
|
Logger Name : random Level: SEVERE
|
||||||
___[ Error Output ]___
|
___[ Error Output ]___
|
||||||
Jul 22, 2016 11:55:52 AM ConfigureLogging sendLogMessages
|
Jul 27, 2016 10:50:38 AM ConfigureLogging sendLogMessages
|
||||||
FINEST: Finest
|
FINEST: Finest
|
||||||
Jul 22, 2016 11:55:52 AM ConfigureLogging sendLogMessages
|
Jul 27, 2016 10:50:38 AM ConfigureLogging sendLogMessages
|
||||||
FINER: Finer
|
FINER: Finer
|
||||||
Jul 22, 2016 11:55:52 AM ConfigureLogging sendLogMessages
|
Jul 27, 2016 10:50:38 AM ConfigureLogging sendLogMessages
|
||||||
FINE: Fine
|
FINE: Fine
|
||||||
Jul 22, 2016 11:55:52 AM ConfigureLogging sendLogMessages
|
Jul 27, 2016 10:50:38 AM ConfigureLogging sendLogMessages
|
||||||
CONFIG: Config
|
CONFIG: Config
|
||||||
Jul 22, 2016 11:55:52 AM ConfigureLogging sendLogMessages
|
Jul 27, 2016 10:50:38 AM ConfigureLogging sendLogMessages
|
||||||
INFO: Info
|
INFO: Info
|
||||||
Jul 22, 2016 11:55:52 AM ConfigureLogging sendLogMessages
|
Jul 27, 2016 10:50:38 AM ConfigureLogging sendLogMessages
|
||||||
WARNING: Warning
|
WARNING: Warning
|
||||||
Jul 22, 2016 11:55:52 AM ConfigureLogging sendLogMessages
|
Jul 27, 2016 10:50:38 AM ConfigureLogging sendLogMessages
|
||||||
SEVERE: Severe
|
SEVERE: Severe
|
||||||
Jul 22, 2016 11:55:52 AM ConfigureLogging sendLogMessages
|
Jul 27, 2016 10:50:38 AM ConfigureLogging sendLogMessages
|
||||||
FINEST: Finest
|
FINEST: Finest
|
||||||
Jul 22, 2016 11:55:52 AM ConfigureLogging sendLogMessages
|
Jul 27, 2016 10:50:38 AM ConfigureLogging sendLogMessages
|
||||||
FINER: Finer
|
FINER: Finer
|
||||||
Jul 22, 2016 11:55:52 AM ConfigureLogging sendLogMessages
|
Jul 27, 2016 10:50:38 AM ConfigureLogging sendLogMessages
|
||||||
FINE: Fine
|
FINE: Fine
|
||||||
Jul 22, 2016 11:55:52 AM ConfigureLogging sendLogMessages
|
Jul 27, 2016 10:50:38 AM ConfigureLogging sendLogMessages
|
||||||
CONFIG: Config
|
CONFIG: Config
|
||||||
Jul 22, 2016 11:55:52 AM ConfigureLogging sendLogMessages
|
Jul 27, 2016 10:50:38 AM ConfigureLogging sendLogMessages
|
||||||
INFO: Info
|
INFO: Info
|
||||||
Jul 22, 2016 11:55:52 AM ConfigureLogging sendLogMessages
|
Jul 27, 2016 10:50:38 AM ConfigureLogging sendLogMessages
|
||||||
WARNING: Warning
|
WARNING: Warning
|
||||||
Jul 22, 2016 11:55:52 AM ConfigureLogging sendLogMessages
|
Jul 27, 2016 10:50:38 AM ConfigureLogging sendLogMessages
|
||||||
SEVERE: Severe
|
SEVERE: Severe
|
||||||
Jul 22, 2016 11:55:52 AM ConfigureLogging sendLogMessages
|
Jul 27, 2016 10:50:38 AM ConfigureLogging sendLogMessages
|
||||||
INFO: Info
|
INFO: Info
|
||||||
Jul 22, 2016 11:55:52 AM ConfigureLogging sendLogMessages
|
Jul 27, 2016 10:50:38 AM ConfigureLogging sendLogMessages
|
||||||
WARNING: Warning
|
WARNING: Warning
|
||||||
Jul 22, 2016 11:55:52 AM ConfigureLogging sendLogMessages
|
Jul 27, 2016 10:50:38 AM ConfigureLogging sendLogMessages
|
||||||
SEVERE: Severe
|
SEVERE: Severe
|
||||||
Jul 22, 2016 11:55:52 AM ConfigureLogging sendLogMessages
|
Jul 27, 2016 10:50:38 AM ConfigureLogging sendLogMessages
|
||||||
FINER: Finer
|
FINER: Finer
|
||||||
Jul 22, 2016 11:55:52 AM ConfigureLogging sendLogMessages
|
Jul 27, 2016 10:50:38 AM ConfigureLogging sendLogMessages
|
||||||
FINE: Fine
|
FINE: Fine
|
||||||
Jul 22, 2016 11:55:52 AM ConfigureLogging sendLogMessages
|
Jul 27, 2016 10:50:38 AM ConfigureLogging sendLogMessages
|
||||||
CONFIG: Config
|
CONFIG: Config
|
||||||
Jul 22, 2016 11:55:52 AM ConfigureLogging sendLogMessages
|
Jul 27, 2016 10:50:38 AM ConfigureLogging sendLogMessages
|
||||||
INFO: Info
|
INFO: Info
|
||||||
Jul 22, 2016 11:55:52 AM ConfigureLogging sendLogMessages
|
Jul 27, 2016 10:50:38 AM ConfigureLogging sendLogMessages
|
||||||
WARNING: Warning
|
WARNING: Warning
|
||||||
Jul 22, 2016 11:55:52 AM ConfigureLogging sendLogMessages
|
Jul 27, 2016 10:50:38 AM ConfigureLogging sendLogMessages
|
||||||
SEVERE: Severe
|
SEVERE: Severe
|
||||||
Jul 22, 2016 11:55:52 AM ConfigureLogging sendLogMessages
|
Jul 27, 2016 10:50:38 AM ConfigureLogging sendLogMessages
|
||||||
SEVERE: Severe
|
SEVERE: Severe
|
||||||
*/
|
*/
|
||||||
|
@ -40,8 +40,8 @@ public class CustomHandler {
|
|||||||
, INFO:, CustomHandler:, main:, <Logging Info>,
|
, INFO:, CustomHandler:, main:, <Logging Info>,
|
||||||
]
|
]
|
||||||
___[ Error Output ]___
|
___[ Error Output ]___
|
||||||
Jul 22, 2016 11:55:52 AM CustomHandler main
|
Jul 27, 2016 10:50:39 AM CustomHandler main
|
||||||
WARNING: Logging Warning
|
WARNING: Logging Warning
|
||||||
Jul 22, 2016 11:55:52 AM CustomHandler main
|
Jul 27, 2016 10:50:39 AM CustomHandler main
|
||||||
INFO: Logging Info
|
INFO: Logging Info
|
||||||
*/
|
*/
|
||||||
|
@ -14,6 +14,6 @@ public class InfoLogging {
|
|||||||
}
|
}
|
||||||
/* Output:
|
/* Output:
|
||||||
___[ Error Output ]___
|
___[ Error Output ]___
|
||||||
Jul 22, 2016 11:55:52 AM InfoLogging main
|
Jul 27, 2016 10:50:39 AM InfoLogging main
|
||||||
INFO: Logging: INFO-level message
|
INFO: Logging: INFO-level message
|
||||||
*/
|
*/
|
||||||
|
@ -16,6 +16,6 @@ public class InfoLogging2 {
|
|||||||
}
|
}
|
||||||
/* Output:
|
/* Output:
|
||||||
___[ Error Output ]___
|
___[ Error Output ]___
|
||||||
Jul 22, 2016 11:55:53 AM InfoLogging2 main
|
Jul 27, 2016 10:50:40 AM InfoLogging2 main
|
||||||
INFO: Logging an INFO-level message
|
INFO: Logging an INFO-level message
|
||||||
*/
|
*/
|
||||||
|
@ -17,6 +17,6 @@ public class LogToFile {
|
|||||||
}
|
}
|
||||||
/* Output:
|
/* Output:
|
||||||
___[ Error Output ]___
|
___[ Error Output ]___
|
||||||
Jul 22, 2016 11:55:53 AM LogToFile main
|
Jul 27, 2016 10:50:41 AM LogToFile main
|
||||||
INFO: A message logged to the file
|
INFO: A message logged to the file
|
||||||
*/
|
*/
|
||||||
|
@ -19,6 +19,6 @@ public class LogToFile2 {
|
|||||||
}
|
}
|
||||||
/* Output:
|
/* Output:
|
||||||
___[ Error Output ]___
|
___[ Error Output ]___
|
||||||
Jul 22, 2016 11:55:53 AM LogToFile2 main
|
Jul 27, 2016 10:50:41 AM LogToFile2 main
|
||||||
INFO: A message logged to the file
|
INFO: A message logged to the file
|
||||||
*/
|
*/
|
||||||
|
@ -76,109 +76,109 @@ onjava : FINEST com.mindviewinc.test : FINEST random :
|
|||||||
FINEST
|
FINEST
|
||||||
net level: FINEST
|
net level: FINEST
|
||||||
___[ Error Output ]___
|
___[ Error Output ]___
|
||||||
Jul 22, 2016 11:55:53 AM LoggingLevelManipulation
|
Jul 27, 2016 10:50:42 AM LoggingLevelManipulation
|
||||||
printLogMessages
|
printLogMessages
|
||||||
SEVERE: com Severe
|
SEVERE: com Severe
|
||||||
Jul 22, 2016 11:55:54 AM LoggingLevelManipulation
|
Jul 27, 2016 10:50:42 AM LoggingLevelManipulation
|
||||||
printLogMessages
|
printLogMessages
|
||||||
SEVERE: com.mindviewinc Severe
|
SEVERE: com.mindviewinc Severe
|
||||||
Jul 22, 2016 11:55:54 AM LoggingLevelManipulation
|
Jul 27, 2016 10:50:42 AM LoggingLevelManipulation
|
||||||
printLogMessages
|
printLogMessages
|
||||||
INFO: onjava Info
|
INFO: onjava Info
|
||||||
Jul 22, 2016 11:55:54 AM LoggingLevelManipulation
|
Jul 27, 2016 10:50:42 AM LoggingLevelManipulation
|
||||||
printLogMessages
|
printLogMessages
|
||||||
WARNING: onjava Warning
|
WARNING: onjava Warning
|
||||||
Jul 22, 2016 11:55:54 AM LoggingLevelManipulation
|
Jul 27, 2016 10:50:42 AM LoggingLevelManipulation
|
||||||
printLogMessages
|
printLogMessages
|
||||||
SEVERE: onjava Severe
|
SEVERE: onjava Severe
|
||||||
Jul 22, 2016 11:55:54 AM LoggingLevelManipulation
|
Jul 27, 2016 10:50:42 AM LoggingLevelManipulation
|
||||||
printLogMessages
|
printLogMessages
|
||||||
SEVERE: com.mindviewinc.test Severe
|
SEVERE: com.mindviewinc.test Severe
|
||||||
Jul 22, 2016 11:55:54 AM LoggingLevelManipulation
|
Jul 27, 2016 10:50:42 AM LoggingLevelManipulation
|
||||||
printLogMessages
|
printLogMessages
|
||||||
INFO: random Info
|
INFO: random Info
|
||||||
Jul 22, 2016 11:55:54 AM LoggingLevelManipulation
|
Jul 27, 2016 10:50:42 AM LoggingLevelManipulation
|
||||||
printLogMessages
|
printLogMessages
|
||||||
WARNING: random Warning
|
WARNING: random Warning
|
||||||
Jul 22, 2016 11:55:54 AM LoggingLevelManipulation
|
Jul 27, 2016 10:50:42 AM LoggingLevelManipulation
|
||||||
printLogMessages
|
printLogMessages
|
||||||
SEVERE: random Severe
|
SEVERE: random Severe
|
||||||
Jul 22, 2016 11:55:54 AM LoggingLevelManipulation
|
Jul 27, 2016 10:50:42 AM LoggingLevelManipulation
|
||||||
printLogMessages
|
printLogMessages
|
||||||
SEVERE: com Severe
|
SEVERE: com Severe
|
||||||
Jul 22, 2016 11:55:54 AM LoggingLevelManipulation
|
Jul 27, 2016 10:50:42 AM LoggingLevelManipulation
|
||||||
printLogMessages
|
printLogMessages
|
||||||
SEVERE: com.mindviewinc Severe
|
SEVERE: com.mindviewinc Severe
|
||||||
Jul 22, 2016 11:55:54 AM LoggingLevelManipulation
|
Jul 27, 2016 10:50:42 AM LoggingLevelManipulation
|
||||||
printLogMessages
|
printLogMessages
|
||||||
INFO: onjava Info
|
INFO: onjava Info
|
||||||
Jul 22, 2016 11:55:54 AM LoggingLevelManipulation
|
Jul 27, 2016 10:50:42 AM LoggingLevelManipulation
|
||||||
printLogMessages
|
printLogMessages
|
||||||
WARNING: onjava Warning
|
WARNING: onjava Warning
|
||||||
Jul 22, 2016 11:55:54 AM LoggingLevelManipulation
|
Jul 27, 2016 10:50:42 AM LoggingLevelManipulation
|
||||||
printLogMessages
|
printLogMessages
|
||||||
SEVERE: onjava Severe
|
SEVERE: onjava Severe
|
||||||
Jul 22, 2016 11:55:54 AM LoggingLevelManipulation
|
Jul 27, 2016 10:50:42 AM LoggingLevelManipulation
|
||||||
printLogMessages
|
printLogMessages
|
||||||
INFO: com.mindviewinc.test Info
|
INFO: com.mindviewinc.test Info
|
||||||
Jul 22, 2016 11:55:54 AM LoggingLevelManipulation
|
Jul 27, 2016 10:50:42 AM LoggingLevelManipulation
|
||||||
printLogMessages
|
printLogMessages
|
||||||
WARNING: com.mindviewinc.test Warning
|
WARNING: com.mindviewinc.test Warning
|
||||||
Jul 22, 2016 11:55:54 AM LoggingLevelManipulation
|
Jul 27, 2016 10:50:42 AM LoggingLevelManipulation
|
||||||
printLogMessages
|
printLogMessages
|
||||||
SEVERE: com.mindviewinc.test Severe
|
SEVERE: com.mindviewinc.test Severe
|
||||||
Jul 22, 2016 11:55:54 AM LoggingLevelManipulation
|
Jul 27, 2016 10:50:42 AM LoggingLevelManipulation
|
||||||
printLogMessages
|
printLogMessages
|
||||||
INFO: random Info
|
INFO: random Info
|
||||||
Jul 22, 2016 11:55:54 AM LoggingLevelManipulation
|
Jul 27, 2016 10:50:42 AM LoggingLevelManipulation
|
||||||
printLogMessages
|
printLogMessages
|
||||||
WARNING: random Warning
|
WARNING: random Warning
|
||||||
Jul 22, 2016 11:55:54 AM LoggingLevelManipulation
|
Jul 27, 2016 10:50:42 AM LoggingLevelManipulation
|
||||||
printLogMessages
|
printLogMessages
|
||||||
SEVERE: random Severe
|
SEVERE: random Severe
|
||||||
Jul 22, 2016 11:55:54 AM LoggingLevelManipulation
|
Jul 27, 2016 10:50:42 AM LoggingLevelManipulation
|
||||||
printLogMessages
|
printLogMessages
|
||||||
INFO: com Info
|
INFO: com Info
|
||||||
Jul 22, 2016 11:55:54 AM LoggingLevelManipulation
|
Jul 27, 2016 10:50:42 AM LoggingLevelManipulation
|
||||||
printLogMessages
|
printLogMessages
|
||||||
WARNING: com Warning
|
WARNING: com Warning
|
||||||
Jul 22, 2016 11:55:54 AM LoggingLevelManipulation
|
Jul 27, 2016 10:50:42 AM LoggingLevelManipulation
|
||||||
printLogMessages
|
printLogMessages
|
||||||
SEVERE: com Severe
|
SEVERE: com Severe
|
||||||
Jul 22, 2016 11:55:54 AM LoggingLevelManipulation
|
Jul 27, 2016 10:50:42 AM LoggingLevelManipulation
|
||||||
printLogMessages
|
printLogMessages
|
||||||
INFO: com.mindviewinc Info
|
INFO: com.mindviewinc Info
|
||||||
Jul 22, 2016 11:55:54 AM LoggingLevelManipulation
|
Jul 27, 2016 10:50:42 AM LoggingLevelManipulation
|
||||||
printLogMessages
|
printLogMessages
|
||||||
WARNING: com.mindviewinc Warning
|
WARNING: com.mindviewinc Warning
|
||||||
Jul 22, 2016 11:55:54 AM LoggingLevelManipulation
|
Jul 27, 2016 10:50:42 AM LoggingLevelManipulation
|
||||||
printLogMessages
|
printLogMessages
|
||||||
SEVERE: com.mindviewinc Severe
|
SEVERE: com.mindviewinc Severe
|
||||||
Jul 22, 2016 11:55:54 AM LoggingLevelManipulation
|
Jul 27, 2016 10:50:42 AM LoggingLevelManipulation
|
||||||
printLogMessages
|
printLogMessages
|
||||||
INFO: onjava Info
|
INFO: onjava Info
|
||||||
Jul 22, 2016 11:55:54 AM LoggingLevelManipulation
|
Jul 27, 2016 10:50:42 AM LoggingLevelManipulation
|
||||||
printLogMessages
|
printLogMessages
|
||||||
WARNING: onjava Warning
|
WARNING: onjava Warning
|
||||||
Jul 22, 2016 11:55:54 AM LoggingLevelManipulation
|
Jul 27, 2016 10:50:42 AM LoggingLevelManipulation
|
||||||
printLogMessages
|
printLogMessages
|
||||||
SEVERE: onjava Severe
|
SEVERE: onjava Severe
|
||||||
Jul 22, 2016 11:55:54 AM LoggingLevelManipulation
|
Jul 27, 2016 10:50:42 AM LoggingLevelManipulation
|
||||||
printLogMessages
|
printLogMessages
|
||||||
INFO: com.mindviewinc.test Info
|
INFO: com.mindviewinc.test Info
|
||||||
Jul 22, 2016 11:55:54 AM LoggingLevelManipulation
|
Jul 27, 2016 10:50:42 AM LoggingLevelManipulation
|
||||||
printLogMessages
|
printLogMessages
|
||||||
WARNING: com.mindviewinc.test Warning
|
WARNING: com.mindviewinc.test Warning
|
||||||
Jul 22, 2016 11:55:54 AM LoggingLevelManipulation
|
Jul 27, 2016 10:50:42 AM LoggingLevelManipulation
|
||||||
printLogMessages
|
printLogMessages
|
||||||
SEVERE: com.mindviewinc.test Severe
|
SEVERE: com.mindviewinc.test Severe
|
||||||
Jul 22, 2016 11:55:54 AM LoggingLevelManipulation
|
Jul 27, 2016 10:50:42 AM LoggingLevelManipulation
|
||||||
printLogMessages
|
printLogMessages
|
||||||
INFO: random Info
|
INFO: random Info
|
||||||
Jul 22, 2016 11:55:54 AM LoggingLevelManipulation
|
Jul 27, 2016 10:50:42 AM LoggingLevelManipulation
|
||||||
printLogMessages
|
printLogMessages
|
||||||
WARNING: random Warning
|
WARNING: random Warning
|
||||||
Jul 22, 2016 11:55:54 AM LoggingLevelManipulation
|
Jul 27, 2016 10:50:42 AM LoggingLevelManipulation
|
||||||
printLogMessages
|
printLogMessages
|
||||||
SEVERE: random Severe
|
SEVERE: random Severe
|
||||||
*/
|
*/
|
||||||
|
@ -40,22 +40,22 @@ com level: SEVERE
|
|||||||
individual loggers set to FINEST
|
individual loggers set to FINEST
|
||||||
com level: SEVERE
|
com level: SEVERE
|
||||||
___[ Error Output ]___
|
___[ Error Output ]___
|
||||||
Jul 22, 2016 11:55:54 AM LoggingLevels logMessages
|
Jul 27, 2016 10:50:42 AM LoggingLevels logMessages
|
||||||
INFO: util : info
|
INFO: util : info
|
||||||
Jul 22, 2016 11:55:54 AM LoggingLevels logMessages
|
Jul 27, 2016 10:50:42 AM LoggingLevels logMessages
|
||||||
SEVERE: test : severe
|
SEVERE: test : severe
|
||||||
Jul 22, 2016 11:55:54 AM LoggingLevels logMessages
|
Jul 27, 2016 10:50:42 AM LoggingLevels logMessages
|
||||||
INFO: random : info
|
INFO: random : info
|
||||||
Jul 22, 2016 11:55:54 AM LoggingLevels logMessages
|
Jul 27, 2016 10:50:42 AM LoggingLevels logMessages
|
||||||
INFO: util : info
|
INFO: util : info
|
||||||
Jul 22, 2016 11:55:54 AM LoggingLevels logMessages
|
Jul 27, 2016 10:50:42 AM LoggingLevels logMessages
|
||||||
SEVERE: test : severe
|
SEVERE: test : severe
|
||||||
Jul 22, 2016 11:55:54 AM LoggingLevels logMessages
|
Jul 27, 2016 10:50:42 AM LoggingLevels logMessages
|
||||||
INFO: random : info
|
INFO: random : info
|
||||||
Jul 22, 2016 11:55:54 AM LoggingLevels logMessages
|
Jul 27, 2016 10:50:42 AM LoggingLevels logMessages
|
||||||
INFO: util : info
|
INFO: util : info
|
||||||
Jul 22, 2016 11:55:54 AM LoggingLevels logMessages
|
Jul 27, 2016 10:50:42 AM LoggingLevels logMessages
|
||||||
SEVERE: test : severe
|
SEVERE: test : severe
|
||||||
Jul 22, 2016 11:55:54 AM LoggingLevels logMessages
|
Jul 27, 2016 10:50:42 AM LoggingLevels logMessages
|
||||||
INFO: random : info
|
INFO: random : info
|
||||||
*/
|
*/
|
||||||
|
@ -20,8 +20,8 @@ public class MultipleHandlers {
|
|||||||
}
|
}
|
||||||
/* Output:
|
/* Output:
|
||||||
___[ Error Output ]___
|
___[ Error Output ]___
|
||||||
Jul 22, 2016 11:55:54 AM MultipleHandlers main
|
Jul 27, 2016 10:50:43 AM MultipleHandlers main
|
||||||
WARNING: Output to multiple handlers
|
WARNING: Output to multiple handlers
|
||||||
Jul 22, 2016 11:55:54 AM MultipleHandlers main
|
Jul 27, 2016 10:50:43 AM MultipleHandlers main
|
||||||
WARNING: Output to multiple handlers
|
WARNING: Output to multiple handlers
|
||||||
*/
|
*/
|
||||||
|
@ -21,6 +21,6 @@ public class MultipleHandlers2 {
|
|||||||
}
|
}
|
||||||
/* Output:
|
/* Output:
|
||||||
___[ Error Output ]___
|
___[ Error Output ]___
|
||||||
Jul 22, 2016 11:55:54 AM MultipleHandlers2 main
|
Jul 27, 2016 10:50:43 AM MultipleHandlers2 main
|
||||||
WARNING: Output to multiple handlers
|
WARNING: Output to multiple handlers
|
||||||
*/
|
*/
|
||||||
|
@ -48,7 +48,7 @@ public class PrintableLogRecord extends LogRecord {
|
|||||||
Level<FINEST>
|
Level<FINEST>
|
||||||
LoggerName<null>
|
LoggerName<null>
|
||||||
Message<Simple Log Record>
|
Message<Simple Log Record>
|
||||||
CurrentMillis<1469210155053>
|
CurrentMillis<1469638244376>
|
||||||
Params<null>
|
Params<null>
|
||||||
ResourceBundle<null>
|
ResourceBundle<null>
|
||||||
ResourceBundleName<null>
|
ResourceBundleName<null>
|
||||||
|
@ -34,12 +34,12 @@ public class SimpleFilter {
|
|||||||
}
|
}
|
||||||
/* Output:
|
/* Output:
|
||||||
___[ Error Output ]___
|
___[ Error Output ]___
|
||||||
Jul 22, 2016 11:55:55 AM SimpleFilter sendLogMessages
|
Jul 27, 2016 10:50:44 AM SimpleFilter sendLogMessages
|
||||||
WARNING: A duck in the house!
|
WARNING: A duck in the house!
|
||||||
Jul 22, 2016 11:55:55 AM SimpleFilter sendLogMessages
|
Jul 27, 2016 10:50:44 AM SimpleFilter sendLogMessages
|
||||||
WARNING: A Wombat at large!
|
WARNING: A Wombat at large!
|
||||||
Jul 22, 2016 11:55:55 AM SimpleFilter main
|
Jul 27, 2016 10:50:44 AM SimpleFilter main
|
||||||
INFO: After setting filter..
|
INFO: After setting filter..
|
||||||
Jul 22, 2016 11:55:55 AM SimpleFilter sendLogMessages
|
Jul 27, 2016 10:50:44 AM SimpleFilter sendLogMessages
|
||||||
WARNING: A duck in the house!
|
WARNING: A duck in the house!
|
||||||
*/
|
*/
|
||||||
|
@ -16,5 +16,5 @@ public class WhoAmI {
|
|||||||
}
|
}
|
||||||
/* Output:
|
/* Output:
|
||||||
MindviewToshibaLaptop
|
MindviewToshibaLaptop
|
||||||
192.168.0.107
|
192.168.0.104
|
||||||
*/
|
*/
|
||||||
|
@ -22,5 +22,5 @@ public class HelloDate {
|
|||||||
}
|
}
|
||||||
/* Output:
|
/* Output:
|
||||||
Hello, it's:
|
Hello, it's:
|
||||||
Fri Jul 22 11:55:55 MDT 2016
|
Wed Jul 27 10:50:45 MDT 2016
|
||||||
*/
|
*/
|
||||||
|
@ -16,7 +16,7 @@ public class ShowProperties {
|
|||||||
java.runtime.name=Java(TM) SE Runtime Environment
|
java.runtime.name=Java(TM) SE Runtime Environment
|
||||||
sun.boot.library.path=C:\Program Files
|
sun.boot.library.path=C:\Program Files
|
||||||
(x86)\Java\jdk1.8.0_...
|
(x86)\Java\jdk1.8.0_...
|
||||||
java.vm.version=25.77-b03
|
java.vm.version=25.102-b14
|
||||||
java.vm.vendor=Oracle Corporation
|
java.vm.vendor=Oracle Corporation
|
||||||
java.vendor.url=http://java.oracle.com/
|
java.vendor.url=http://java.oracle.com/
|
||||||
path.separator=;
|
path.separator=;
|
||||||
@ -29,7 +29,7 @@ sun.os.patch.level=
|
|||||||
java.vm.specification.name=Java Virtual Machine
|
java.vm.specification.name=Java Virtual Machine
|
||||||
Specification
|
Specification
|
||||||
user.dir=C:\Users\Bruce\Documents\GitHub\on-ja...
|
user.dir=C:\Users\Bruce\Documents\GitHub\on-ja...
|
||||||
java.runtime.version=1.8.0_77-b03
|
java.runtime.version=1.8.0_102-b14
|
||||||
java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment
|
java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment
|
||||||
java.endorsed.dirs=C:\Program Files (x86)\Java\jdk1.8.0_...
|
java.endorsed.dirs=C:\Program Files (x86)\Java\jdk1.8.0_...
|
||||||
os.arch=x86
|
os.arch=x86
|
||||||
|
365
output_duet.py
365
output_duet.py
@ -1,365 +0,0 @@
|
|||||||
# Requires Python 3.5 or greater
|
|
||||||
# (c)2016 MindView LLC: see Copyright.txt
|
|
||||||
# We make no guarantees that this code is fit for any purpose.
|
|
||||||
# Visit http://mindviewinc.com/Books/OnJava/ for more book information.
|
|
||||||
"""
|
|
||||||
ToDo:
|
|
||||||
- Right now it's ignoring the "(first x lines)" examples
|
|
||||||
"""
|
|
||||||
import sys
|
|
||||||
from pathlib import Path
|
|
||||||
import re
|
|
||||||
import textwrap
|
|
||||||
from enum import Enum, unique
|
|
||||||
|
|
||||||
def trace(str): pass
|
|
||||||
# trace = print
|
|
||||||
|
|
||||||
maxlinewidth = 59
|
|
||||||
current_dir_name = Path.cwd().stem
|
|
||||||
|
|
||||||
word_only = re.compile("[A-Za-z]+")
|
|
||||||
|
|
||||||
def trim(block):
|
|
||||||
trimmed = "\n".join([ln.rstrip() for ln in block.splitlines()])
|
|
||||||
return trimmed.strip()
|
|
||||||
|
|
||||||
class Adjuster:
|
|
||||||
def adjust(self, input_text): pass
|
|
||||||
|
|
||||||
class IgnoreDigits(Adjuster):
|
|
||||||
def adjust(self, input_text):
|
|
||||||
trace("Ignoring digits")
|
|
||||||
return trim(re.sub("-?\d", "", input_text))
|
|
||||||
|
|
||||||
ignore_digits = IgnoreDigits()
|
|
||||||
|
|
||||||
class IgnoreMemoryAddresses(Adjuster):
|
|
||||||
def adjust(self, input_text):
|
|
||||||
return trim(memlocation.sub("", input_text))
|
|
||||||
|
|
||||||
ignore_memory_addresses = IgnoreMemoryAddresses()
|
|
||||||
|
|
||||||
class RemoveCharacters(Adjuster):
|
|
||||||
def __init__(self, chars_to_remove):
|
|
||||||
self.chars_to_remove = chars_to_remove
|
|
||||||
def adjust(self, input_text):
|
|
||||||
for c in self.chars_to_remove:
|
|
||||||
input_text = input_text.replace(c, "")
|
|
||||||
return input_text
|
|
||||||
|
|
||||||
class SortLines(Adjuster):
|
|
||||||
def adjust(self, input_text):
|
|
||||||
return "\n".join(sorted(input_text.splitlines())).strip()
|
|
||||||
|
|
||||||
sort_lines = SortLines()
|
|
||||||
|
|
||||||
class SortWords(Adjuster):
|
|
||||||
def adjust(self, input_text):
|
|
||||||
return "\n".join(sorted(input_text.split())).strip()
|
|
||||||
|
|
||||||
sort_words = SortWords()
|
|
||||||
|
|
||||||
class UniqueLines(Adjuster):
|
|
||||||
def adjust(self, input_text):
|
|
||||||
return "\n".join(sorted(list(set(input_text.splitlines()))))
|
|
||||||
|
|
||||||
unique_lines = UniqueLines()
|
|
||||||
|
|
||||||
class UniqueWords(Adjuster):
|
|
||||||
# Fairly extreme but will still reveal significant changes
|
|
||||||
def adjust(self, input_text):
|
|
||||||
return "\n".join(sorted(set(input_text.split())))
|
|
||||||
|
|
||||||
unique_words = UniqueWords()
|
|
||||||
|
|
||||||
class WordsOnly(Adjuster):
|
|
||||||
# Fairly extreme but will still reveal significant changes
|
|
||||||
def adjust(self, input_text):
|
|
||||||
return "\n".join(
|
|
||||||
sorted([w for w in input_text.split()
|
|
||||||
if word_only.fullmatch(w)]))
|
|
||||||
|
|
||||||
words_only = WordsOnly()
|
|
||||||
|
|
||||||
class IgnoreLines(Adjuster):
|
|
||||||
def __init__(self, *lines_to_ignore):
|
|
||||||
self.lines_to_ignore = lines_to_ignore
|
|
||||||
def adjust(self, input_text):
|
|
||||||
lines = input_text.splitlines()
|
|
||||||
for ignore in sorted(list(self.lines_to_ignore), reverse=True):
|
|
||||||
ignore = ignore - 1 # Compensate for zero indexing
|
|
||||||
print("ignoring line %d: %s" % (ignore, lines[ignore]))
|
|
||||||
del lines[ignore]
|
|
||||||
return "\n".join(lines)
|
|
||||||
|
|
||||||
|
|
||||||
match_adjustments = {
|
|
||||||
"ToastOMatic.java" : sort_lines,
|
|
||||||
"ThreadVariations.java" : sort_lines,
|
|
||||||
"ActiveObjectDemo.java" : [sort_lines, ignore_digits],
|
|
||||||
"Interrupting.java" : sort_lines,
|
|
||||||
"SyncObject.java" : sort_lines,
|
|
||||||
"UseCaseTracker.java" : sort_lines,
|
|
||||||
"AtUnitComposition.java" : sort_lines,
|
|
||||||
"AtUnitExample1.java" : sort_lines,
|
|
||||||
"AtUnitExample2.java" : sort_lines,
|
|
||||||
"AtUnitExample3.java" : sort_lines,
|
|
||||||
"AtUnitExample5.java" : sort_lines,
|
|
||||||
"AtUnitExternalTest.java" : sort_lines,
|
|
||||||
"HashSetTest.java" : sort_lines,
|
|
||||||
"StackLStringTest.java" : sort_lines,
|
|
||||||
"WaxOMatic2.java" : sort_lines,
|
|
||||||
|
|
||||||
"ForEach.java" : sort_words,
|
|
||||||
"PetCount4.java" : [RemoveCharacters("{}"), sort_words],
|
|
||||||
|
|
||||||
"CachedThreadPool.java" : words_only,
|
|
||||||
"FixedThreadPool.java" : words_only,
|
|
||||||
"MoreBasicThreads.java" : words_only,
|
|
||||||
"ConstantSpecificMethod.java" : words_only,
|
|
||||||
|
|
||||||
"BankTellerSimulation.java" : [words_only, unique_words],
|
|
||||||
|
|
||||||
"MapComparisons.java" : ignore_digits,
|
|
||||||
"ListComparisons.java" : ignore_digits,
|
|
||||||
"NotifyVsNotifyAll.java" : ignore_digits,
|
|
||||||
"SelfManaged.java" : ignore_digits,
|
|
||||||
"SimpleMicroBenchmark.java" : ignore_digits,
|
|
||||||
"SimpleThread.java" : ignore_digits,
|
|
||||||
"SleepingTask.java" : ignore_digits,
|
|
||||||
"ExchangerDemo.java" : ignore_digits,
|
|
||||||
"Compete.java" : ignore_digits,
|
|
||||||
"MappedIO.java" : ignore_digits,
|
|
||||||
"Directories.java" : ignore_digits,
|
|
||||||
"Find.java" : ignore_digits,
|
|
||||||
"PathAnalysis.java" : ignore_digits,
|
|
||||||
"TreeWatcher.java" : ignore_digits,
|
|
||||||
"Mixins.java" : ignore_digits,
|
|
||||||
"ListPerformance.java" : ignore_digits,
|
|
||||||
"MapPerformance.java" : ignore_digits,
|
|
||||||
"SetPerformance.java" : ignore_digits,
|
|
||||||
"SynchronizationComparisons.java" : ignore_digits,
|
|
||||||
"AtomicityTest.java" : ignore_digits,
|
|
||||||
"TypesForSets.java" : ignore_digits,
|
|
||||||
"PrintableLogRecord.java" : ignore_digits,
|
|
||||||
"LockingMappedFiles.java" : ignore_digits,
|
|
||||||
|
|
||||||
|
|
||||||
"Conversion.java" : IgnoreLines(27, 28),
|
|
||||||
"DynamicProxyMixin.java" : IgnoreLines(2),
|
|
||||||
"PreferencesDemo.java" : IgnoreLines(5),
|
|
||||||
"AtUnitExample4.java" : IgnoreLines(6, 9),
|
|
||||||
|
|
||||||
"SerialNumberChecker.java" : [ignore_digits, unique_lines],
|
|
||||||
"EvenSupplier.java" : [ignore_digits, unique_lines],
|
|
||||||
|
|
||||||
"FillingLists.java" : [ ignore_memory_addresses, sort_words ],
|
|
||||||
|
|
||||||
"SimpleDaemons.java" : [ ignore_memory_addresses, ignore_digits ],
|
|
||||||
"CaptureUncaughtException.java" : [
|
|
||||||
ignore_memory_addresses, ignore_digits, unique_lines ],
|
|
||||||
|
|
||||||
"CarBuilder.java" : [ ignore_digits, unique_lines ],
|
|
||||||
"CloseResource.java" : [ unique_lines ],
|
|
||||||
|
|
||||||
"SpringDetector.java" : [ ignore_digits, sort_words ],
|
|
||||||
|
|
||||||
"PipedIO.java" : [ unique_words ],
|
|
||||||
|
|
||||||
"CriticalSection.java" : ignore_digits,
|
|
||||||
"ExplicitCriticalSection.java" : ignore_digits,
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
translate_file_name = {
|
|
||||||
"ApplyTest.java": "Apply.java",
|
|
||||||
"FillTest.java": "Fill.java",
|
|
||||||
"Fill2Test.java": "Fill2.java",
|
|
||||||
"ClassInInterface$Test.java": "ClassInInterface.java",
|
|
||||||
"TestBed$Tester.java": "TestBed.java",
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
memlocation = re.compile("@[0-9a-z]{5,7}")
|
|
||||||
datestamp1 = re.compile("(?:[MTWFS][a-z]{2} ){0,1}[JFMASOND][a-z]{2} \d{1,2} \d{2}:\d{2}:\d{2} [A-Z]{3} \d{4}")
|
|
||||||
datestamp2 = re.compile("[JFMASOND][a-z]{2} \d{1,2}, \d{4} \d{1,2}:\d{1,2}:\d{1,2} (:?AM|PM)")
|
|
||||||
varying = [ memlocation, datestamp1, datestamp2 ]
|
|
||||||
|
|
||||||
|
|
||||||
# Result of Duet.validate():
|
|
||||||
Valid = Enum('Valid',
|
|
||||||
'exact varying execute_to_see selected_lines fail')
|
|
||||||
|
|
||||||
|
|
||||||
class Duet:
|
|
||||||
"""
|
|
||||||
Holds embedded and generated output. Also original file content, and
|
|
||||||
"adjusted" output for comparison.
|
|
||||||
"""
|
|
||||||
|
|
||||||
def __init__(self, out_filename):
|
|
||||||
|
|
||||||
if not (out_filename.suffix == ".out" or
|
|
||||||
out_filename.suffix == ".err" or
|
|
||||||
out_filename.suffix == ".new"):
|
|
||||||
print("Error: argument to Duet() must end with '.out' or '.err' or '.new'")
|
|
||||||
print("Argument was {}".format(out_filename))
|
|
||||||
sys.exit()
|
|
||||||
|
|
||||||
self.java_file = None # Full contents of Java code file
|
|
||||||
self.java_slugline = None # First (marker) line of Java code file
|
|
||||||
|
|
||||||
self.out_path = out_filename.with_suffix(".out")
|
|
||||||
self.out = None
|
|
||||||
self.generated = ""
|
|
||||||
if self.out_path.exists():
|
|
||||||
self.out = self.out_path.read_text().strip()
|
|
||||||
trace("{} file exists".format(self.out_path))
|
|
||||||
self.generated = self.fill_to_width(self.out)
|
|
||||||
|
|
||||||
self.error = False
|
|
||||||
self.err_path = out_filename.with_suffix(".err")
|
|
||||||
if self.err_path.exists():
|
|
||||||
self.error = True
|
|
||||||
self.generated += "\n___[ Error Output ]___\n"
|
|
||||||
self.generated += self.fill_to_width(self.err_path.read_text())
|
|
||||||
trace("{} file exists".format(self.err_path))
|
|
||||||
|
|
||||||
self.new = None
|
|
||||||
self.new_path = out_filename.with_suffix(".new")
|
|
||||||
if self.new_path.exists():
|
|
||||||
self.new = self.new_path.read_text().strip()
|
|
||||||
print("{} file exists".format(self.new_path))
|
|
||||||
|
|
||||||
self.java_path = self.calculate_java_path()
|
|
||||||
# This also fills self.java_file and self.java_slugline:
|
|
||||||
self.embedded = self.embedded_output()
|
|
||||||
|
|
||||||
self.ignore = False
|
|
||||||
if "{IgnoreOutput}" in self.java_file:
|
|
||||||
self.ignore = True
|
|
||||||
trace("Ignoring .out for {}".format(self.java_path))
|
|
||||||
return
|
|
||||||
|
|
||||||
if "{ThrowsException}" in self.java_file:
|
|
||||||
self.generated = self.generated.strip() + "\n___[ Exception is Expected ]___"
|
|
||||||
trace("Exception expected for {}".format(self.java_path))
|
|
||||||
|
|
||||||
if "{ErrorOutputExpected}" in self.java_file:
|
|
||||||
self.generated = self.generated.strip() + "\n___[ Error Output is Expected ]___"
|
|
||||||
trace("OK: 'Error Output' expected for {}".format(self.java_path))
|
|
||||||
|
|
||||||
self.embedded_adjusted = self.adjust(self.embedded)
|
|
||||||
self.generated_un_adjusted = self.generated
|
|
||||||
self.generated_adjusted = None
|
|
||||||
if self.generated:
|
|
||||||
self.generated_adjusted = self.adjust(self.generated)
|
|
||||||
|
|
||||||
def calculate_java_path(self):
|
|
||||||
|
|
||||||
def __java_filename(out_pieces):
|
|
||||||
path_components = out_pieces.split(".", out_pieces.count(".") - 1)
|
|
||||||
# path_components[-1] = path_components[-1].replace(".out", ".java")
|
|
||||||
# path_components[-1] = path_components[-1].replace(".err", ".java")
|
|
||||||
return path_components
|
|
||||||
|
|
||||||
_java_path = self.out_path.with_suffix(".java")
|
|
||||||
jfn = __java_filename(_java_path.parts[-1])
|
|
||||||
# jfn = __java_filename(self.out_path.parts[-1])
|
|
||||||
jpath = list(self.out_path.parts[:-1]) + list(jfn)
|
|
||||||
if len(jpath) > 1 and jpath[0] == jpath[1]:
|
|
||||||
del jpath[0]
|
|
||||||
if jpath[0] == current_dir_name:
|
|
||||||
del jpath[0]
|
|
||||||
if jpath[-1] in translate_file_name:
|
|
||||||
jpath[-1] = translate_file_name[jpath[-1]]
|
|
||||||
return Path(*jpath)
|
|
||||||
|
|
||||||
|
|
||||||
def embedded_output(self):
|
|
||||||
find_output = re.compile(r"/\* (Output:.*)\*/", re.DOTALL) # should space be \s+ ??
|
|
||||||
with self.java_path.open() as java:
|
|
||||||
self.java_file = java.read()
|
|
||||||
self.java_slugline = self.java_file.strip().splitlines()[0]
|
|
||||||
output = find_output.search(self.java_file)
|
|
||||||
if not output:
|
|
||||||
trace("No embedded output: in {}".format(self.java_path))
|
|
||||||
return None
|
|
||||||
lines = output.group(1).strip().splitlines()
|
|
||||||
self.output_tag = lines[0]
|
|
||||||
return ("\n".join(lines[1:])).strip()
|
|
||||||
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def fill_to_width(text):
|
|
||||||
result = ""
|
|
||||||
for line in text.splitlines():
|
|
||||||
result += textwrap.fill(line, width=maxlinewidth) + "\n"
|
|
||||||
return result.strip()
|
|
||||||
|
|
||||||
|
|
||||||
def __repr__(self):
|
|
||||||
# result = "\n" + str(self.output_tag)
|
|
||||||
result = "\n" + str(self.java_path).center(60, "=") + "\n" + self.embedded
|
|
||||||
result += "\n" + str(self.out_path).center(60, "-") + "\n" + self.generated
|
|
||||||
result += "\n" + (str(self.java_path) +
|
|
||||||
"(adjusted)").center(60, "-") + "\n" + str(self.embedded_adjusted)
|
|
||||||
result += "\n" + (str(self.out_path) +
|
|
||||||
"(adjusted)").center(60, "-") + "\n" + str(self.generated_adjusted)
|
|
||||||
|
|
||||||
difflines = []
|
|
||||||
embedded_adjusted_lines = self.embedded_adjusted.splitlines()
|
|
||||||
generated_adjusted_lines = self.generated_adjusted.splitlines()
|
|
||||||
trace(str(self.java_path))
|
|
||||||
trace("len embedded_adjusted %d len generated_adjusted %d" %
|
|
||||||
(len(embedded_adjusted_lines), len(generated_adjusted_lines)))
|
|
||||||
for n, line in enumerate(embedded_adjusted_lines):
|
|
||||||
try:
|
|
||||||
if not line == generated_adjusted_lines[n]:
|
|
||||||
difflines.append(">--------<")
|
|
||||||
difflines.append("embedded_adjusted: " + line)
|
|
||||||
difflines.append("generated_adjusted: " + generated_adjusted_lines[n])
|
|
||||||
except:
|
|
||||||
continue
|
|
||||||
if difflines:
|
|
||||||
result += "\n" + "\n".join(difflines)
|
|
||||||
|
|
||||||
return result
|
|
||||||
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def strip_varying(text):
|
|
||||||
for pat in varying:
|
|
||||||
text = pat.sub("", text)
|
|
||||||
return text
|
|
||||||
|
|
||||||
|
|
||||||
def adjust(self, output):
|
|
||||||
output = output.replace("\0", "NUL")
|
|
||||||
if self.java_path.name not in match_adjustments:
|
|
||||||
return output
|
|
||||||
trace("adjusting %s" % self.java_path.name)
|
|
||||||
strategy = match_adjustments[self.java_path.name]
|
|
||||||
if isinstance(strategy, Adjuster):
|
|
||||||
return strategy.adjust(output)
|
|
||||||
assert isinstance(strategy, list)
|
|
||||||
for strat in strategy:
|
|
||||||
output = strat.adjust(output)
|
|
||||||
return output
|
|
||||||
|
|
||||||
|
|
||||||
def validate(self):
|
|
||||||
if "(Execute to see)" in self.output_tag:
|
|
||||||
return Valid.execute_to_see
|
|
||||||
if "(None)" in self.output_tag: ### This should no longer be necessary
|
|
||||||
assert false, "(None) in output_tag " + self
|
|
||||||
if "Output: (First" in self.output_tag: ### This is temporary ###
|
|
||||||
return Valid.selected_lines
|
|
||||||
if self.generated_adjusted == self.embedded_adjusted:
|
|
||||||
return Valid.exact
|
|
||||||
if isinstance(self.generated_adjusted, str):
|
|
||||||
if (Duet.strip_varying(self.generated_adjusted) ==
|
|
||||||
Duet.strip_varying(self.embedded_adjusted)):
|
|
||||||
return Valid.varying
|
|
||||||
return Valid.fail
|
|
@ -30,10 +30,10 @@ Location: Oz
|
|||||||
Footwear: Ruby Slippers
|
Footwear: Ruby Slippers
|
||||||
Companions: 4
|
Companions: 4
|
||||||
Are there witches?: true
|
Are there witches?: true
|
||||||
UsageCount: 183
|
UsageCount: 191
|
||||||
How many companions does Dorothy have? 4
|
How many companions does Dorothy have? 4
|
||||||
___[ Error Output ]___
|
___[ Error Output ]___
|
||||||
Jul 22, 2016 11:56:00 AM java.util.prefs.WindowsPreferences
|
Jul 27, 2016 10:50:50 AM java.util.prefs.WindowsPreferences
|
||||||
<init>
|
<init>
|
||||||
WARNING: Could not open/create prefs root node
|
WARNING: Could not open/create prefs root node
|
||||||
Software\JavaSoft\Prefs at root 0x80000002. Windows
|
Software\JavaSoft\Prefs at root 0x80000002. Windows
|
||||||
|
@ -81,6 +81,6 @@ public class Compete {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Output:
|
/* Output:
|
||||||
Duplication via serialization: 296 Milliseconds
|
Duplication via serialization: 776 Milliseconds
|
||||||
Duplication via cloning: 20 Milliseconds
|
Duplication via cloning: 122 Milliseconds
|
||||||
*/
|
*/
|
||||||
|
@ -42,11 +42,11 @@ public class Logon implements Serializable {
|
|||||||
/* Output:
|
/* Output:
|
||||||
logon a = logon info:
|
logon a = logon info:
|
||||||
username: Hulk
|
username: Hulk
|
||||||
date: Fri Jul 22 11:56:03 MDT 2016
|
date: Wed Jul 27 10:50:53 MDT 2016
|
||||||
password: myLittlePony
|
password: myLittlePony
|
||||||
Recovering object at Fri Jul 22 11:56:04 MDT 2016
|
Recovering object at Wed Jul 27 10:50:55 MDT 2016
|
||||||
logon a = logon info:
|
logon a = logon info:
|
||||||
username: Hulk
|
username: Hulk
|
||||||
date: Fri Jul 22 11:56:03 MDT 2016
|
date: Wed Jul 27 10:50:53 MDT 2016
|
||||||
password: null
|
password: null
|
||||||
*/
|
*/
|
||||||
|
@ -69,16 +69,16 @@ animals: [Bosco the dog[Animal@1db9742], House@106d69c
|
|||||||
, Ralph the hamster[Animal@52e922], House@106d69c
|
, Ralph the hamster[Animal@52e922], House@106d69c
|
||||||
, Molly the cat[Animal@25154f], House@106d69c
|
, Molly the cat[Animal@25154f], House@106d69c
|
||||||
]
|
]
|
||||||
animals1: [Bosco the dog[Animal@10bedb4], House@103dbd3
|
animals1: [Bosco the dog[Animal@1a4f24f], House@19a45b3
|
||||||
, Ralph the hamster[Animal@167cf4d], House@103dbd3
|
, Ralph the hamster[Animal@99a589], House@19a45b3
|
||||||
, Molly the cat[Animal@a987ac], House@103dbd3
|
, Molly the cat[Animal@372a00], House@19a45b3
|
||||||
]
|
]
|
||||||
animals2: [Bosco the dog[Animal@10bedb4], House@103dbd3
|
animals2: [Bosco the dog[Animal@1a4f24f], House@19a45b3
|
||||||
, Ralph the hamster[Animal@167cf4d], House@103dbd3
|
, Ralph the hamster[Animal@99a589], House@19a45b3
|
||||||
, Molly the cat[Animal@a987ac], House@103dbd3
|
, Molly the cat[Animal@372a00], House@19a45b3
|
||||||
]
|
]
|
||||||
animals3: [Bosco the dog[Animal@a3a380], House@1453f44
|
animals3: [Bosco the dog[Animal@dd8dc3], House@103e736
|
||||||
, Ralph the hamster[Animal@ad8086], House@1453f44
|
, Ralph the hamster[Animal@8db2f2], House@103e736
|
||||||
, Molly the cat[Animal@be858], House@1453f44
|
, Molly the cat[Animal@18bf509], House@103e736
|
||||||
]
|
]
|
||||||
*/
|
*/
|
||||||
|
@ -23,6 +23,6 @@ public class ForEach {
|
|||||||
}
|
}
|
||||||
/* Output:
|
/* Output:
|
||||||
258 555 693 861 961 429 868 200 522 207 288 128 551 589
|
258 555 693 861 961 429 868 200 522 207 288 128 551 589
|
||||||
551 589 200 522 868 861 288 128 207 555 429 693 961 258
|
551 589 200 861 522 429 868 961 288 555 128 693 207 258
|
||||||
258 555 693 861 961 429 868 200 522 207 288 128 551 589
|
258 555 693 861 961 429 868 200 522 207 288 128 551 589
|
||||||
*/
|
*/
|
||||||
|
@ -1,74 +0,0 @@
|
|||||||
#! py -3
|
|
||||||
# Requires Python 3.5
|
|
||||||
# Validates output from executable Java programs in "On Java 8"
|
|
||||||
# (1) Extract output in Java file, keep whole file
|
|
||||||
# (2) If direct comparison of actual output with output stored in Java file fails:
|
|
||||||
# (3) Use chain of responsibility to successively try filters until one matches or all fail
|
|
||||||
from pathlib import Path
|
|
||||||
import textwrap
|
|
||||||
import re
|
|
||||||
|
|
||||||
def fill_to_width(text):
|
|
||||||
result = ""
|
|
||||||
for line in text.splitlines():
|
|
||||||
result += textwrap.fill(line, width=59) + "\n"
|
|
||||||
return result.strip()
|
|
||||||
|
|
||||||
def adjust_lines(text):
|
|
||||||
text = text.replace("\0", "NUL")
|
|
||||||
lines = text.splitlines()
|
|
||||||
slug = lines[0]
|
|
||||||
if "(First and Last " in slug:
|
|
||||||
num_of_lines = int(slug.split()[5])
|
|
||||||
adjusted = lines[:num_of_lines + 1] +\
|
|
||||||
["...________...________...________...________..."] +\
|
|
||||||
lines[-num_of_lines:]
|
|
||||||
return "\n".join(adjusted)
|
|
||||||
elif "(First " in slug:
|
|
||||||
num_of_lines = int(slug.split()[3])
|
|
||||||
adjusted = lines[:num_of_lines + 1] +\
|
|
||||||
[" ..."]
|
|
||||||
return "\n".join(adjusted)
|
|
||||||
else:
|
|
||||||
return text
|
|
||||||
|
|
||||||
def phase1():
|
|
||||||
"""
|
|
||||||
(0) Do first/last lines before formatting to width
|
|
||||||
(1) Combine output and error (if present) files
|
|
||||||
(2) Format all output to width limit
|
|
||||||
(3) Add closing '*/'
|
|
||||||
"""
|
|
||||||
for outfile in Path(".").rglob("*.out"):
|
|
||||||
out_text = adjust_lines(outfile.read_text())
|
|
||||||
phase_1 = outfile.with_suffix(".p1")
|
|
||||||
with phase_1.open('w') as phs1:
|
|
||||||
phs1.write(fill_to_width(out_text) + "\n")
|
|
||||||
errfile = outfile.with_suffix(".err")
|
|
||||||
if errfile.exists():
|
|
||||||
phs1.write("___[ Error Output ]___\n")
|
|
||||||
phs1.write(fill_to_width(errfile.read_text()) + "\n")
|
|
||||||
phs1.write("*/\n")
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
phase1()
|
|
||||||
find_output = re.compile(r"/\* (Output:.*)\*/", re.DOTALL) # should space be \s+ ??
|
|
||||||
for outfile in Path(".").rglob("*.p1"):
|
|
||||||
javafile = outfile.with_suffix(".java")
|
|
||||||
if not javafile.exists():
|
|
||||||
print(str(outfile) + " has no javafile")
|
|
||||||
javatext = javafile.read_text()
|
|
||||||
if "/* Output:" not in javatext:
|
|
||||||
print(str(outfile) + " has no /* Output:")
|
|
||||||
embedded_output = find_output.search(javatext).group(0).strip()
|
|
||||||
new_output = outfile.read_text().strip()
|
|
||||||
if new_output == embedded_output:
|
|
||||||
print(str(javafile))
|
|
||||||
else:
|
|
||||||
with outfile.with_suffix(".nomatch").open('w') as nomatch:
|
|
||||||
nomatch.write(str(embedded_output) + "\n\n")
|
|
||||||
nomatch.write("=== Actual ===\n\n")
|
|
||||||
nomatch.write(str(new_output))
|
|
||||||
print(" No Match ".center(45, "="))
|
|
||||||
for nomatch in Path(".").rglob("*.nomatch"):
|
|
||||||
print(nomatch)
|
|
@ -29,5 +29,5 @@ public class AtomicityTest implements Runnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Output:
|
/* Output:
|
||||||
5
|
1
|
||||||
*/
|
*/
|
||||||
|
@ -56,5 +56,4 @@ tryLock(): true
|
|||||||
tryLock(2, TimeUnit.SECONDS): true
|
tryLock(2, TimeUnit.SECONDS): true
|
||||||
tryLock(): true
|
tryLock(): true
|
||||||
tryLock(2, TimeUnit.SECONDS): true
|
tryLock(2, TimeUnit.SECONDS): true
|
||||||
acquired
|
|
||||||
*/
|
*/
|
||||||
|
@ -204,15 +204,15 @@ public class BankTellerSimulation {
|
|||||||
[552][727][998][902][769][373][313][683][177][526] { T3 T2
|
[552][727][998][902][769][373][313][683][177][526] { T3 T2
|
||||||
T1 T0 }
|
T1 T0 }
|
||||||
TellerManager interrupted
|
TellerManager interrupted
|
||||||
|
Teller 3 interrupted
|
||||||
|
CustomerSupplier interrupted
|
||||||
|
Teller 3 terminating
|
||||||
|
Teller 2 interrupted
|
||||||
|
Teller 2 terminating
|
||||||
|
TellerManager terminating
|
||||||
|
Teller 1 interrupted
|
||||||
Teller 0 interrupted
|
Teller 0 interrupted
|
||||||
Teller 0 terminating
|
Teller 0 terminating
|
||||||
Teller 1 interrupted
|
|
||||||
Teller 3 interrupted
|
|
||||||
Teller 2 interrupted
|
|
||||||
CustomerSupplier interrupted
|
|
||||||
CustomerSupplier terminating
|
|
||||||
Teller 2 terminating
|
|
||||||
Teller 3 terminating
|
|
||||||
Teller 1 terminating
|
Teller 1 terminating
|
||||||
TellerManager terminating
|
CustomerSupplier terminating
|
||||||
*/
|
*/
|
||||||
|
@ -16,14 +16,14 @@ public class CachedThreadPool {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Output:
|
/* Output:
|
||||||
SleepAndPrintTask[0] pool-1-thread-1
|
|
||||||
SleepAndPrintTask[5] pool-1-thread-6
|
|
||||||
SleepAndPrintTask[8] pool-1-thread-9
|
|
||||||
SleepAndPrintTask[4] pool-1-thread-5
|
|
||||||
SleepAndPrintTask[9] pool-1-thread-10
|
|
||||||
SleepAndPrintTask[1] pool-1-thread-2
|
|
||||||
SleepAndPrintTask[2] pool-1-thread-3
|
SleepAndPrintTask[2] pool-1-thread-3
|
||||||
|
SleepAndPrintTask[9] pool-1-thread-10
|
||||||
SleepAndPrintTask[6] pool-1-thread-7
|
SleepAndPrintTask[6] pool-1-thread-7
|
||||||
|
SleepAndPrintTask[5] pool-1-thread-6
|
||||||
SleepAndPrintTask[7] pool-1-thread-8
|
SleepAndPrintTask[7] pool-1-thread-8
|
||||||
|
SleepAndPrintTask[8] pool-1-thread-9
|
||||||
|
SleepAndPrintTask[0] pool-1-thread-1
|
||||||
|
SleepAndPrintTask[1] pool-1-thread-2
|
||||||
|
SleepAndPrintTask[4] pool-1-thread-5
|
||||||
SleepAndPrintTask[3] pool-1-thread-4
|
SleepAndPrintTask[3] pool-1-thread-4
|
||||||
*/
|
*/
|
||||||
|
@ -16,14 +16,14 @@ public class CachedThreadPool2 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Output:
|
/* Output:
|
||||||
2 pool-1-thread-3 518
|
0 pool-1-thread-1 200
|
||||||
1 pool-1-thread-2 518
|
4 pool-1-thread-5 300
|
||||||
0 pool-1-thread-1 518
|
3 pool-1-thread-4 400
|
||||||
6 pool-1-thread-7 618
|
1 pool-1-thread-2 200
|
||||||
5 pool-1-thread-6 518
|
2 pool-1-thread-3 200
|
||||||
4 pool-1-thread-5 518
|
6 pool-1-thread-7 500
|
||||||
3 pool-1-thread-4 518
|
8 pool-1-thread-9 757
|
||||||
9 pool-1-thread-10 918
|
5 pool-1-thread-6 657
|
||||||
8 pool-1-thread-9 818
|
7 pool-1-thread-8 657
|
||||||
7 pool-1-thread-8 718
|
9 pool-1-thread-10 857
|
||||||
*/
|
*/
|
||||||
|
@ -33,15 +33,15 @@ public class CachedThreadPool3 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Output:
|
/* Output:
|
||||||
3 pool-1-thread-4 100
|
|
||||||
5 pool-1-thread-6 100
|
|
||||||
6 pool-1-thread-7 100
|
|
||||||
1 pool-1-thread-2 100
|
|
||||||
2 pool-1-thread-3 100
|
2 pool-1-thread-3 100
|
||||||
|
6 pool-1-thread-7 100
|
||||||
|
5 pool-1-thread-6 100
|
||||||
7 pool-1-thread-8 100
|
7 pool-1-thread-8 100
|
||||||
8 pool-1-thread-9 100
|
|
||||||
4 pool-1-thread-5 100
|
4 pool-1-thread-5 100
|
||||||
0 pool-1-thread-1 100
|
|
||||||
9 pool-1-thread-10 100
|
9 pool-1-thread-10 100
|
||||||
|
3 pool-1-thread-4 100
|
||||||
|
0 pool-1-thread-1 100
|
||||||
|
1 pool-1-thread-2 100
|
||||||
|
8 pool-1-thread-9 100
|
||||||
sum = 1000
|
sum = 1000
|
||||||
*/
|
*/
|
||||||
|
@ -54,7 +54,7 @@ run() by Thread-1
|
|||||||
eh = MyUncaughtExceptionHandler@d93b30
|
eh = MyUncaughtExceptionHandler@d93b30
|
||||||
HandlerThreadFactory@14991ad creating new Thread
|
HandlerThreadFactory@14991ad creating new Thread
|
||||||
created Thread[Thread-2,5,main]
|
created Thread[Thread-2,5,main]
|
||||||
eh = MyUncaughtExceptionHandler@28e402
|
eh = MyUncaughtExceptionHandler@1351c58
|
||||||
caught java.lang.RuntimeException
|
caught java.lang.RuntimeException
|
||||||
TimedAbort 4
|
TimedAbort 4
|
||||||
*/
|
*/
|
||||||
|
@ -221,9 +221,9 @@ public class CarBuilder {
|
|||||||
/* Output:
|
/* Output:
|
||||||
ChassisBuilder created Car 0 [ engine: false driveTrain:
|
ChassisBuilder created Car 0 [ engine: false driveTrain:
|
||||||
false wheels: false ]
|
false wheels: false ]
|
||||||
EngineRobot installing engine
|
|
||||||
WheelRobot installing Wheels
|
WheelRobot installing Wheels
|
||||||
DriveTrainRobot installing DriveTrain
|
DriveTrainRobot installing DriveTrain
|
||||||
|
EngineRobot installing engine
|
||||||
Car 0 [ engine: true driveTrain: true wheels: true ]
|
Car 0 [ engine: true driveTrain: true wheels: true ]
|
||||||
ChassisBuilder created Car 1 [ engine: false driveTrain:
|
ChassisBuilder created Car 1 [ engine: false driveTrain:
|
||||||
false wheels: false ]
|
false wheels: false ]
|
||||||
@ -233,15 +233,15 @@ DriveTrainRobot installing DriveTrain
|
|||||||
Car 1 [ engine: true driveTrain: true wheels: true ]
|
Car 1 [ engine: true driveTrain: true wheels: true ]
|
||||||
ChassisBuilder created Car 2 [ engine: false driveTrain:
|
ChassisBuilder created Car 2 [ engine: false driveTrain:
|
||||||
false wheels: false ]
|
false wheels: false ]
|
||||||
EngineRobot installing engine
|
|
||||||
DriveTrainRobot installing DriveTrain
|
DriveTrainRobot installing DriveTrain
|
||||||
WheelRobot installing Wheels
|
WheelRobot installing Wheels
|
||||||
|
EngineRobot installing engine
|
||||||
Car 2 [ engine: true driveTrain: true wheels: true ]
|
Car 2 [ engine: true driveTrain: true wheels: true ]
|
||||||
ChassisBuilder created Car 3 [ engine: false driveTrain:
|
ChassisBuilder created Car 3 [ engine: false driveTrain:
|
||||||
false wheels: false ]
|
false wheels: false ]
|
||||||
EngineRobot installing engine
|
|
||||||
WheelRobot installing Wheels
|
|
||||||
DriveTrainRobot installing DriveTrain
|
DriveTrainRobot installing DriveTrain
|
||||||
|
WheelRobot installing Wheels
|
||||||
|
EngineRobot installing engine
|
||||||
Car 3 [ engine: true driveTrain: true wheels: true ]
|
Car 3 [ engine: true driveTrain: true wheels: true ]
|
||||||
ChassisBuilder created Car 4 [ engine: false driveTrain:
|
ChassisBuilder created Car 4 [ engine: false driveTrain:
|
||||||
false wheels: false ]
|
false wheels: false ]
|
||||||
@ -252,8 +252,8 @@ Car 4 [ engine: true driveTrain: true wheels: true ]
|
|||||||
ChassisBuilder created Car 5 [ engine: false driveTrain:
|
ChassisBuilder created Car 5 [ engine: false driveTrain:
|
||||||
false wheels: false ]
|
false wheels: false ]
|
||||||
EngineRobot installing engine
|
EngineRobot installing engine
|
||||||
DriveTrainRobot installing DriveTrain
|
|
||||||
WheelRobot installing Wheels
|
WheelRobot installing Wheels
|
||||||
|
DriveTrainRobot installing DriveTrain
|
||||||
Car 5 [ engine: true driveTrain: true wheels: true ]
|
Car 5 [ engine: true driveTrain: true wheels: true ]
|
||||||
ChassisBuilder created Car 6 [ engine: false driveTrain:
|
ChassisBuilder created Car 6 [ engine: false driveTrain:
|
||||||
false wheels: false ]
|
false wheels: false ]
|
||||||
@ -270,26 +270,26 @@ Car 7 [ engine: true driveTrain: true wheels: true ]
|
|||||||
ChassisBuilder created Car 8 [ engine: false driveTrain:
|
ChassisBuilder created Car 8 [ engine: false driveTrain:
|
||||||
false wheels: false ]
|
false wheels: false ]
|
||||||
EngineRobot installing engine
|
EngineRobot installing engine
|
||||||
DriveTrainRobot installing DriveTrain
|
|
||||||
WheelRobot installing Wheels
|
WheelRobot installing Wheels
|
||||||
|
DriveTrainRobot installing DriveTrain
|
||||||
Car 8 [ engine: true driveTrain: true wheels: true ]
|
Car 8 [ engine: true driveTrain: true wheels: true ]
|
||||||
ChassisBuilder created Car 9 [ engine: false driveTrain:
|
ChassisBuilder created Car 9 [ engine: false driveTrain:
|
||||||
false wheels: false ]
|
false wheels: false ]
|
||||||
DriveTrainRobot installing DriveTrain
|
DriveTrainRobot installing DriveTrain
|
||||||
WheelRobot installing Wheels
|
|
||||||
EngineRobot installing engine
|
EngineRobot installing engine
|
||||||
|
WheelRobot installing Wheels
|
||||||
Car 9 [ engine: true driveTrain: true wheels: true ]
|
Car 9 [ engine: true driveTrain: true wheels: true ]
|
||||||
ChassisBuilder created Car 10 [ engine: false driveTrain:
|
ChassisBuilder created Car 10 [ engine: false driveTrain:
|
||||||
false wheels: false ]
|
false wheels: false ]
|
||||||
WheelRobot installing Wheels
|
|
||||||
DriveTrainRobot installing DriveTrain
|
DriveTrainRobot installing DriveTrain
|
||||||
EngineRobot installing engine
|
EngineRobot installing engine
|
||||||
|
WheelRobot installing Wheels
|
||||||
Car 10 [ engine: true driveTrain: true wheels: true ]
|
Car 10 [ engine: true driveTrain: true wheels: true ]
|
||||||
ChassisBuilder created Car 11 [ engine: false driveTrain:
|
ChassisBuilder created Car 11 [ engine: false driveTrain:
|
||||||
false wheels: false ]
|
false wheels: false ]
|
||||||
DriveTrainRobot installing DriveTrain
|
|
||||||
WheelRobot installing Wheels
|
|
||||||
EngineRobot installing engine
|
EngineRobot installing engine
|
||||||
|
WheelRobot installing Wheels
|
||||||
|
DriveTrainRobot installing DriveTrain
|
||||||
Car 11 [ engine: true driveTrain: true wheels: true ]
|
Car 11 [ engine: true driveTrain: true wheels: true ]
|
||||||
ChassisBuilder created Car 12 [ engine: false driveTrain:
|
ChassisBuilder created Car 12 [ engine: false driveTrain:
|
||||||
false wheels: false ]
|
false wheels: false ]
|
||||||
@ -297,16 +297,16 @@ DriveTrainRobot installing DriveTrain
|
|||||||
WheelRobot installing Wheels
|
WheelRobot installing Wheels
|
||||||
EngineRobot installing engine
|
EngineRobot installing engine
|
||||||
Car 12 [ engine: true driveTrain: true wheels: true ]
|
Car 12 [ engine: true driveTrain: true wheels: true ]
|
||||||
Exiting Reporter via interrupt
|
|
||||||
Reporter off
|
|
||||||
Exiting EngineRobot via interrupt
|
|
||||||
EngineRobot off
|
|
||||||
Exiting DriveTrainRobot via interrupt
|
|
||||||
Exiting WheelRobot via interrupt
|
|
||||||
Interrupted: ChassisBuilder
|
|
||||||
Exiting Assembler via interrupt
|
Exiting Assembler via interrupt
|
||||||
ChassisBuilder off
|
Exiting EngineRobot via interrupt
|
||||||
WheelRobot off
|
Exiting WheelRobot via interrupt
|
||||||
|
Exiting DriveTrainRobot via interrupt
|
||||||
DriveTrainRobot off
|
DriveTrainRobot off
|
||||||
|
Exiting Reporter via interrupt
|
||||||
|
Interrupted: ChassisBuilder
|
||||||
|
Reporter off
|
||||||
|
WheelRobot off
|
||||||
|
EngineRobot off
|
||||||
Assembler off
|
Assembler off
|
||||||
|
ChassisBuilder off
|
||||||
*/
|
*/
|
||||||
|
@ -17,15 +17,15 @@ public class CountingStream {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Output:
|
/* Output:
|
||||||
0 ForkJoinPool.commonPool-worker-4 100
|
4 ForkJoinPool.commonPool-worker-5 100
|
||||||
4 ForkJoinPool.commonPool-worker-3 100
|
|
||||||
3 ForkJoinPool.commonPool-worker-5 100
|
|
||||||
6 main 100
|
|
||||||
8 ForkJoinPool.commonPool-worker-6 100
|
|
||||||
5 ForkJoinPool.commonPool-worker-7 100
|
|
||||||
2 ForkJoinPool.commonPool-worker-1 100
|
2 ForkJoinPool.commonPool-worker-1 100
|
||||||
1 ForkJoinPool.commonPool-worker-2 100
|
6 main 100
|
||||||
9 ForkJoinPool.commonPool-worker-3 100
|
5 ForkJoinPool.commonPool-worker-1 100
|
||||||
7 ForkJoinPool.commonPool-worker-4 100
|
7 ForkJoinPool.commonPool-worker-4 100
|
||||||
|
1 ForkJoinPool.commonPool-worker-3 100
|
||||||
|
8 ForkJoinPool.commonPool-worker-2 100
|
||||||
|
0 ForkJoinPool.commonPool-worker-6 100
|
||||||
|
9 ForkJoinPool.commonPool-worker-7 100
|
||||||
|
3 ForkJoinPool.commonPool-worker-5 100
|
||||||
1000
|
1000
|
||||||
*/
|
*/
|
||||||
|
@ -32,25 +32,25 @@ public class DeadlockingDiningPhilosophers {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Output: (First and Last 10 Lines)
|
/* Output: (First and Last 10 Lines)
|
||||||
Philosopher 2 thinking
|
|
||||||
Philosopher 3 thinking
|
|
||||||
Philosopher 3 grabbing right
|
|
||||||
Philosopher 3 grabbing left
|
|
||||||
Philosopher 3 eating
|
|
||||||
Philosopher 1 thinking
|
|
||||||
Philosopher 1 grabbing right
|
|
||||||
Philosopher 1 grabbing left
|
|
||||||
Philosopher 4 thinking
|
|
||||||
Philosopher 0 thinking
|
Philosopher 0 thinking
|
||||||
...________...________...________...________...
|
Philosopher 4 thinking
|
||||||
Philosopher 0 grabbing right
|
Philosopher 1 thinking
|
||||||
|
Philosopher 3 thinking
|
||||||
|
Philosopher 2 thinking
|
||||||
|
Philosopher 3 grabbing right
|
||||||
Philosopher 1 grabbing right
|
Philosopher 1 grabbing right
|
||||||
|
Philosopher 4 grabbing right
|
||||||
|
Philosopher 0 grabbing right
|
||||||
|
Philosopher 4 grabbing left
|
||||||
|
...________...________...________...________...
|
||||||
|
Philosopher 3 grabbing left
|
||||||
Philosopher 1 grabbing left
|
Philosopher 1 grabbing left
|
||||||
|
Philosopher 4 grabbing left
|
||||||
Philosopher 2 grabbing left
|
Philosopher 2 grabbing left
|
||||||
Philosopher 0 grabbing left
|
Philosopher 0 grabbing left
|
||||||
Philosopher 1 exiting via interrupt
|
Philosopher 1 exiting via interrupt
|
||||||
Philosopher 0 exiting via interrupt
|
|
||||||
Philosopher 3 exiting via interrupt
|
|
||||||
Philosopher 4 exiting via interrupt
|
Philosopher 4 exiting via interrupt
|
||||||
|
Philosopher 3 exiting via interrupt
|
||||||
Philosopher 2 exiting via interrupt
|
Philosopher 2 exiting via interrupt
|
||||||
|
Philosopher 0 exiting via interrupt
|
||||||
*/
|
*/
|
||||||
|
@ -20,8 +20,7 @@ public class EvenSupplier extends IntSupplier {
|
|||||||
}
|
}
|
||||||
/* Output:
|
/* Output:
|
||||||
Press Control-C to exit
|
Press Control-C to exit
|
||||||
23 not even!
|
193 not even!
|
||||||
27 not even!
|
191 not even!
|
||||||
25 not even!
|
|
||||||
TimedAbort 4
|
TimedAbort 4
|
||||||
*/
|
*/
|
||||||
|
@ -52,12 +52,12 @@ public class ExplicitCriticalSection {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Output:
|
/* Output:
|
||||||
pm1: Pair: x: 10, y: 10 checkCounter = 3504848
|
pm1: Pair: x: 10, y: 10 checkCounter = 1713716
|
||||||
pm2: Pair: x: 10, y: 10 checkCounter = 2105413
|
pm2: Pair: x: 10, y: 10 checkCounter = 1717747
|
||||||
___[ Error Output ]___
|
___[ Error Output ]___
|
||||||
Exception in thread "pool-1-thread-3" Exception in thread
|
Exception in thread "pool-1-thread-4" Exception in thread
|
||||||
"pool-1-thread-4" threads.Pair$PairValuesNotEqualException:
|
"pool-1-thread-3" threads.Pair$PairValuesNotEqualException:
|
||||||
Pair values not equal: x: 3, y: 2
|
Pair values not equal: x: 2, y: 1
|
||||||
at threads.Pair.checkState(CriticalSection.java:37)
|
at threads.Pair.checkState(CriticalSection.java:37)
|
||||||
at
|
at
|
||||||
threads.PairChecker.run(CriticalSection.java:111)
|
threads.PairChecker.run(CriticalSection.java:111)
|
||||||
@ -67,7 +67,7 @@ r(ThreadPoolExecutor.java:1142)
|
|||||||
un(ThreadPoolExecutor.java:617)
|
un(ThreadPoolExecutor.java:617)
|
||||||
at java.lang.Thread.run(Thread.java:745)
|
at java.lang.Thread.run(Thread.java:745)
|
||||||
threads.Pair$PairValuesNotEqualException: Pair values not
|
threads.Pair$PairValuesNotEqualException: Pair values not
|
||||||
equal: x: 3, y: 2
|
equal: x: 2, y: 1
|
||||||
at threads.Pair.checkState(CriticalSection.java:37)
|
at threads.Pair.checkState(CriticalSection.java:37)
|
||||||
at
|
at
|
||||||
threads.PairChecker.run(CriticalSection.java:111)
|
threads.PairChecker.run(CriticalSection.java:111)
|
||||||
|
@ -36,25 +36,25 @@ public class FixedDiningPhilosophers {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Output: (First and Last 10 Lines)
|
/* Output: (First and Last 10 Lines)
|
||||||
Philosopher 0 thinking
|
|
||||||
Philosopher 4 thinking
|
|
||||||
Philosopher 3 thinking
|
|
||||||
Philosopher 2 thinking
|
|
||||||
Philosopher 1 thinking
|
Philosopher 1 thinking
|
||||||
Philosopher 0 grabbing right
|
Philosopher 4 thinking
|
||||||
|
Philosopher 2 thinking
|
||||||
|
Philosopher 0 thinking
|
||||||
|
Philosopher 3 thinking
|
||||||
|
Philosopher 1 grabbing right
|
||||||
|
Philosopher 2 grabbing right
|
||||||
|
Philosopher 4 grabbing right
|
||||||
|
Philosopher 4 grabbing left
|
||||||
|
Philosopher 4 eating
|
||||||
|
...________...________...________...________...
|
||||||
|
Philosopher 1 thinking
|
||||||
Philosopher 0 grabbing left
|
Philosopher 0 grabbing left
|
||||||
Philosopher 0 eating
|
Philosopher 0 eating
|
||||||
Philosopher 3 grabbing right
|
Philosopher 2 eating
|
||||||
Philosopher 2 grabbing right
|
Philosopher 1 grabbing right
|
||||||
...________...________...________...________...
|
|
||||||
Philosopher 4 thinking
|
|
||||||
Philosopher 3 grabbing left
|
|
||||||
Philosopher 3 eating
|
|
||||||
Philosopher 0 eating
|
|
||||||
Philosopher 4 grabbing right
|
|
||||||
Philosopher 3 exiting via interrupt
|
Philosopher 3 exiting via interrupt
|
||||||
Philosopher 0 exiting via interrupt
|
|
||||||
Philosopher 1 exiting via interrupt
|
Philosopher 1 exiting via interrupt
|
||||||
Philosopher 4 exiting via interrupt
|
|
||||||
Philosopher 2 exiting via interrupt
|
Philosopher 2 exiting via interrupt
|
||||||
|
Philosopher 0 exiting via interrupt
|
||||||
|
Philosopher 4 exiting via interrupt
|
||||||
*/
|
*/
|
||||||
|
@ -181,22 +181,22 @@ Turning on lights
|
|||||||
Turning off lights
|
Turning off lights
|
||||||
...________...________...________...________...
|
...________...________...________...________...
|
||||||
Terminating
|
Terminating
|
||||||
Fri Jul 22 12:00:00 MDT 2016 temperature: 66.3 humidity:
|
Wed Jul 27 11:00:00 MDT 2016 temperature: 66.3 humidity:
|
||||||
50.20
|
50.20
|
||||||
Fri Jul 22 12:30:00 MDT 2016 temperature: 67.3 humidity:
|
Wed Jul 27 11:30:00 MDT 2016 temperature: 67.3 humidity:
|
||||||
51.02
|
51.02
|
||||||
Fri Jul 22 13:00:00 MDT 2016 temperature: 68.8 humidity:
|
Wed Jul 27 12:00:00 MDT 2016 temperature: 68.8 humidity:
|
||||||
51.82
|
51.82
|
||||||
Fri Jul 22 13:30:00 MDT 2016 temperature: 70.0 humidity:
|
Wed Jul 27 12:30:00 MDT 2016 temperature: 70.0 humidity:
|
||||||
52.19
|
52.19
|
||||||
Fri Jul 22 14:00:00 MDT 2016 temperature: 71.5 humidity:
|
Wed Jul 27 13:00:00 MDT 2016 temperature: 71.5 humidity:
|
||||||
52.99
|
52.99
|
||||||
Fri Jul 22 14:30:00 MDT 2016 temperature: 73.0 humidity:
|
Wed Jul 27 13:30:00 MDT 2016 temperature: 73.0 humidity:
|
||||||
53.32
|
53.32
|
||||||
Fri Jul 22 15:00:00 MDT 2016 temperature: 74.4 humidity:
|
Wed Jul 27 14:00:00 MDT 2016 temperature: 74.4 humidity:
|
||||||
53.99
|
53.99
|
||||||
Fri Jul 22 15:30:00 MDT 2016 temperature: 75.5 humidity:
|
Wed Jul 27 14:30:00 MDT 2016 temperature: 75.5 humidity:
|
||||||
54.40
|
54.40
|
||||||
Fri Jul 22 16:00:00 MDT 2016 temperature: 76.8 humidity:
|
Wed Jul 27 15:00:00 MDT 2016 temperature: 76.8 humidity:
|
||||||
53.96
|
53.96
|
||||||
*/
|
*/
|
||||||
|
@ -96,52 +96,50 @@ public class HorseRace {
|
|||||||
2
|
2
|
||||||
*3
|
*3
|
||||||
**4
|
**4
|
||||||
**5
|
*5
|
||||||
*6
|
**6
|
||||||
===========================================================
|
===========================================================
|
||||||
================
|
================
|
||||||
**0
|
**0
|
||||||
****1
|
***1
|
||||||
*2
|
**2
|
||||||
**3
|
**3
|
||||||
***4
|
***4
|
||||||
****5
|
*5
|
||||||
*6
|
****6
|
||||||
===========================================================
|
===========================================================
|
||||||
================
|
================
|
||||||
**0
|
**0
|
||||||
...________...________...________...________...
|
...________...________...________...________...
|
||||||
***********************************************************
|
***********************************************************
|
||||||
6
|
*******6
|
||||||
===========================================================
|
===========================================================
|
||||||
================
|
================
|
||||||
***********************************************************
|
***********************************************************
|
||||||
************0
|
**********0
|
||||||
***********************************************************
|
|
||||||
*********1
|
|
||||||
***********************************************************
|
|
||||||
****2
|
|
||||||
***********************************************************
|
|
||||||
**************3
|
|
||||||
***********************************************************
|
|
||||||
**4
|
|
||||||
******************************************************5
|
|
||||||
***********************************************************
|
|
||||||
**6
|
|
||||||
===========================================================
|
|
||||||
================
|
|
||||||
***********************************************************
|
|
||||||
*************0
|
|
||||||
***********************************************************
|
***********************************************************
|
||||||
**********1
|
**********1
|
||||||
***********************************************************
|
***********************************************************
|
||||||
****2
|
***********2
|
||||||
***********************************************************
|
***********************************************************
|
||||||
****************3
|
***************3
|
||||||
|
********************************************************4
|
||||||
|
*********************************************************5
|
||||||
***********************************************************
|
***********************************************************
|
||||||
****4
|
*******6
|
||||||
********************************************************5
|
===========================================================
|
||||||
|
================
|
||||||
***********************************************************
|
***********************************************************
|
||||||
****6
|
***********0
|
||||||
|
***********************************************************
|
||||||
|
**********1
|
||||||
|
***********************************************************
|
||||||
|
************2
|
||||||
|
***********************************************************
|
||||||
|
*****************3
|
||||||
|
*********************************************************4
|
||||||
|
**********************************************************5
|
||||||
|
***********************************************************
|
||||||
|
*******6
|
||||||
Horse 3 won!
|
Horse 3 won!
|
||||||
*/
|
*/
|
||||||
|
@ -30,5 +30,5 @@ public class ParallelStreamPuzzle2 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Output:
|
/* Output:
|
||||||
[29, 30, 31, 33, 35, 36, 37, 38, 39, 91]
|
[2, 3, 4, 5, 6, 7, 8, 9, 10, 63]
|
||||||
*/
|
*/
|
||||||
|
@ -18,15 +18,15 @@ public class ParallelStreamPuzzle3 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Output:
|
/* Output:
|
||||||
|
8: main
|
||||||
6: ForkJoinPool.commonPool-worker-5
|
6: ForkJoinPool.commonPool-worker-5
|
||||||
3: ForkJoinPool.commonPool-worker-7
|
3: ForkJoinPool.commonPool-worker-7
|
||||||
2: ForkJoinPool.commonPool-worker-6
|
|
||||||
0: ForkJoinPool.commonPool-worker-4
|
|
||||||
4: ForkJoinPool.commonPool-worker-1
|
|
||||||
1: ForkJoinPool.commonPool-worker-3
|
|
||||||
8: main
|
|
||||||
7: ForkJoinPool.commonPool-worker-7
|
|
||||||
5: ForkJoinPool.commonPool-worker-5
|
5: ForkJoinPool.commonPool-worker-5
|
||||||
|
1: ForkJoinPool.commonPool-worker-3
|
||||||
|
2: ForkJoinPool.commonPool-worker-6
|
||||||
|
4: ForkJoinPool.commonPool-worker-1
|
||||||
|
0: ForkJoinPool.commonPool-worker-4
|
||||||
|
7: main
|
||||||
9: ForkJoinPool.commonPool-worker-2
|
9: ForkJoinPool.commonPool-worker-2
|
||||||
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
|
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
|
||||||
*/
|
*/
|
||||||
|
@ -133,11 +133,11 @@ public class PriorityBlockingQueueDemo {
|
|||||||
[10 ] Task 20
|
[10 ] Task 20
|
||||||
[8 ] Task 8
|
[8 ] Task 8
|
||||||
[10 ] Task 21
|
[10 ] Task 21
|
||||||
[7 ] Task 19
|
|
||||||
[10 ] Task 22
|
|
||||||
[7 ] Task 11
|
|
||||||
[10 ] Task 23
|
|
||||||
[7 ] Task 4
|
[7 ] Task 4
|
||||||
|
[10 ] Task 22
|
||||||
|
[7 ] Task 19
|
||||||
|
[10 ] Task 23
|
||||||
|
[7 ] Task 11
|
||||||
[10 ] Task 24
|
[10 ] Task 24
|
||||||
[7 ] Task 1
|
[7 ] Task 1
|
||||||
...________...________...________...________...
|
...________...________...________...________...
|
||||||
|
@ -65,5 +65,5 @@ public class SerialNumberChecker {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Output:
|
/* Output:
|
||||||
Duplicate: 5178
|
Duplicate: 4119
|
||||||
*/
|
*/
|
||||||
|
@ -27,24 +27,23 @@ public class SingleThreadExecutor {
|
|||||||
/* Output:
|
/* Output:
|
||||||
All tasks submitted
|
All tasks submitted
|
||||||
main awaiting termination
|
main awaiting termination
|
||||||
main awaiting termination
|
|
||||||
SleepAndPrintTask[0] pool-1-thread-1
|
SleepAndPrintTask[0] pool-1-thread-1
|
||||||
|
main awaiting termination
|
||||||
SleepAndPrintTask[1] pool-1-thread-1
|
SleepAndPrintTask[1] pool-1-thread-1
|
||||||
main awaiting termination
|
main awaiting termination
|
||||||
main awaiting termination
|
|
||||||
SleepAndPrintTask[2] pool-1-thread-1
|
SleepAndPrintTask[2] pool-1-thread-1
|
||||||
SleepAndPrintTask[3] pool-1-thread-1
|
|
||||||
main awaiting termination
|
main awaiting termination
|
||||||
|
SleepAndPrintTask[3] pool-1-thread-1
|
||||||
main awaiting termination
|
main awaiting termination
|
||||||
SleepAndPrintTask[4] pool-1-thread-1
|
SleepAndPrintTask[4] pool-1-thread-1
|
||||||
main awaiting termination
|
main awaiting termination
|
||||||
SleepAndPrintTask[5] pool-1-thread-1
|
SleepAndPrintTask[5] pool-1-thread-1
|
||||||
|
main awaiting termination
|
||||||
SleepAndPrintTask[6] pool-1-thread-1
|
SleepAndPrintTask[6] pool-1-thread-1
|
||||||
main awaiting termination
|
main awaiting termination
|
||||||
main awaiting termination
|
|
||||||
SleepAndPrintTask[7] pool-1-thread-1
|
SleepAndPrintTask[7] pool-1-thread-1
|
||||||
SleepAndPrintTask[8] pool-1-thread-1
|
|
||||||
main awaiting termination
|
main awaiting termination
|
||||||
|
SleepAndPrintTask[8] pool-1-thread-1
|
||||||
main awaiting termination
|
main awaiting termination
|
||||||
SleepAndPrintTask[9] pool-1-thread-1
|
SleepAndPrintTask[9] pool-1-thread-1
|
||||||
*/
|
*/
|
||||||
|
@ -44,7 +44,7 @@ public class Summing {
|
|||||||
}
|
}
|
||||||
/* Output:
|
/* Output:
|
||||||
5000000050000000
|
5000000050000000
|
||||||
Sum Stream: 629ms
|
Sum Stream: 631ms
|
||||||
Sum Stream Parallel: 167ms
|
Sum Stream Parallel: 159ms
|
||||||
Sum Iterated: 2537ms
|
Sum Iterated: 2560ms
|
||||||
*/
|
*/
|
||||||
|
@ -36,8 +36,8 @@ public class Summing2 {
|
|||||||
}
|
}
|
||||||
/* Output:
|
/* Output:
|
||||||
200000010000000
|
200000010000000
|
||||||
Array Stream Sum: 111ms
|
Array Stream Sum: 112ms
|
||||||
Parallel: 26ms
|
Parallel: 28ms
|
||||||
Basic Sum: 33ms
|
Basic Sum: 33ms
|
||||||
parallelPrefix: 50ms
|
parallelPrefix: 60ms
|
||||||
*/
|
*/
|
||||||
|
@ -35,7 +35,7 @@ public class Summing3 {
|
|||||||
}
|
}
|
||||||
/* Output:
|
/* Output:
|
||||||
50000005000000
|
50000005000000
|
||||||
Long Array Stream Reduce: 1142ms
|
Long Array Stream Reduce: 1038ms
|
||||||
Long Basic Sum: 21ms
|
Long Basic Sum: 21ms
|
||||||
Long parallelPrefix: 3571ms
|
Long parallelPrefix: 3616ms
|
||||||
*/
|
*/
|
||||||
|
@ -16,5 +16,5 @@ public class Summing4 {
|
|||||||
}
|
}
|
||||||
/* Output:
|
/* Output:
|
||||||
50000005000000
|
50000005000000
|
||||||
Long Parallel: 978ms
|
Long Parallel: 1014ms
|
||||||
*/
|
*/
|
||||||
|
@ -194,11 +194,11 @@ Toast 12: BUTTERED
|
|||||||
Toast 12: JAMMED
|
Toast 12: JAMMED
|
||||||
Chomp! Toast 12: JAMMED
|
Chomp! Toast 12: JAMMED
|
||||||
Eater interrupted
|
Eater interrupted
|
||||||
Butterer interrupted
|
|
||||||
Toaster interrupted
|
|
||||||
Toaster off
|
|
||||||
Jammer interrupted
|
|
||||||
Butterer off
|
|
||||||
Eater off
|
Eater off
|
||||||
|
Jammer interrupted
|
||||||
Jammer off
|
Jammer off
|
||||||
|
Toaster interrupted
|
||||||
|
Butterer interrupted
|
||||||
|
Butterer off
|
||||||
|
Toaster off
|
||||||
*/
|
*/
|
||||||
|
@ -28,12 +28,12 @@ public class WorkStealingPool {
|
|||||||
8
|
8
|
||||||
ForkJoinPool-1-worker-1
|
ForkJoinPool-1-worker-1
|
||||||
ForkJoinPool-1-worker-2
|
ForkJoinPool-1-worker-2
|
||||||
ForkJoinPool-1-worker-3
|
|
||||||
ForkJoinPool-1-worker-3
|
|
||||||
ForkJoinPool-1-worker-3
|
|
||||||
ForkJoinPool-1-worker-4
|
|
||||||
ForkJoinPool-1-worker-5
|
|
||||||
ForkJoinPool-1-worker-3
|
|
||||||
ForkJoinPool-1-worker-2
|
|
||||||
ForkJoinPool-1-worker-1
|
ForkJoinPool-1-worker-1
|
||||||
|
ForkJoinPool-1-worker-1
|
||||||
|
ForkJoinPool-1-worker-4
|
||||||
|
ForkJoinPool-1-worker-1
|
||||||
|
ForkJoinPool-1-worker-3
|
||||||
|
ForkJoinPool-1-worker-5
|
||||||
|
ForkJoinPool-1-worker-4
|
||||||
|
ForkJoinPool-1-worker-2
|
||||||
*/
|
*/
|
||||||
|
@ -218,14 +218,14 @@ Customer 0 eating LENTILS
|
|||||||
WaitPerson 0 received SPRING_ROLLS delivering to Customer 3
|
WaitPerson 0 received SPRING_ROLLS delivering to Customer 3
|
||||||
Customer 3 eating SPRING_ROLLS
|
Customer 3 eating SPRING_ROLLS
|
||||||
...________...________...________...________...
|
...________...________...________...________...
|
||||||
WaitPerson 0 off duty
|
WaitPerson 2 off duty
|
||||||
|
Customer 33 finished meal, leaving
|
||||||
|
Customer 18 finished meal, leaving
|
||||||
|
Customer 35 finished meal, leaving
|
||||||
Customer 46 finished meal, leaving
|
Customer 46 finished meal, leaving
|
||||||
Customer 37 finished meal, leaving
|
WaitPerson 4 off duty
|
||||||
Customer 31 finished meal, leaving
|
Customer 24 finished meal, leaving
|
||||||
Customer 1 finished meal, leaving
|
Customer 30 finished meal, leaving
|
||||||
Customer 3 finished meal, leaving
|
Customer 34 finished meal, leaving
|
||||||
Customer 17 finished meal, leaving
|
Customer 48 finished meal, leaving
|
||||||
Customer 12 finished meal, leaving
|
|
||||||
Customer 4 finished meal, leaving
|
|
||||||
Customer 7 finished meal, leaving
|
|
||||||
*/
|
*/
|
||||||
|
@ -21,5 +21,5 @@ Rat Manx Cymric Mutt Pug Cymric Pug Manx Cymric Rat
|
|||||||
EgyptianMau Hamster EgyptianMau Mutt Mutt Cymric Mouse Pug
|
EgyptianMau Hamster EgyptianMau Mutt Mutt Cymric Mouse Pug
|
||||||
Mouse Cymric
|
Mouse Cymric
|
||||||
{EgyptianMau=2, Hamster=1, Pug=3, Manx=7, Cymric=5, Dog=6,
|
{EgyptianMau=2, Hamster=1, Pug=3, Manx=7, Cymric=5, Dog=6,
|
||||||
Mutt=3, Rat=2, Mouse=2, Rodent=5, Pet=20, Cat=9}
|
Pet=20, Mutt=3, Rat=2, Mouse=2, Rodent=5, Cat=9}
|
||||||
*/
|
*/
|
||||||
|
244
verify_output.py
244
verify_output.py
@ -1,74 +1,184 @@
|
|||||||
# Requires Python 3.5 or greater
|
#! py -3
|
||||||
# (c)2016 MindView LLC: see Copyright.txt
|
# Requires Python 3.5
|
||||||
# We make no guarantees that this code is fit for any purpose.
|
# Validates output from executable Java programs in "On Java 8."
|
||||||
# Visit http://mindviewinc.com/Books/OnJava/ for more book information.
|
# Use chain of responsibility to successively try strategies until one matches
|
||||||
"""
|
|
||||||
ToDo:
|
|
||||||
- Validate errors
|
|
||||||
"""
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from output_duet import Duet, Valid
|
import textwrap
|
||||||
|
import re
|
||||||
|
import sys
|
||||||
import os
|
import os
|
||||||
import collections
|
import textwrap
|
||||||
import pprint
|
from collections import defaultdict
|
||||||
import itertools
|
WIDTH = 59 # Max line width
|
||||||
|
|
||||||
def trace(*str): pass
|
#################### Phase 1: Basic formatting #####################
|
||||||
# trace = print
|
|
||||||
|
|
||||||
def clean():
|
def adjust_lines(text):
|
||||||
for p in (Path(f) for f in [
|
text = text.replace("\0", "NUL")
|
||||||
"update_output.bat",
|
lines = text.splitlines()
|
||||||
"edit_errors.bat",
|
slug = lines[0]
|
||||||
"strategies.txt",
|
if "(First and Last " in slug:
|
||||||
"validate_successes.txt",
|
num_of_lines = int(slug.split()[5])
|
||||||
"validate_failures.txt",
|
adjusted = lines[:num_of_lines + 1] +\
|
||||||
]):
|
["...________...________...________...________..."] +\
|
||||||
if p.exists():
|
lines[-num_of_lines:]
|
||||||
p.unlink()
|
return "\n".join(adjusted)
|
||||||
|
elif "(First " in slug:
|
||||||
|
num_of_lines = int(slug.split()[3])
|
||||||
|
adjusted = lines[:num_of_lines + 1] +\
|
||||||
|
[" ..."]
|
||||||
|
return "\n".join(adjusted)
|
||||||
|
else:
|
||||||
|
return text
|
||||||
|
|
||||||
|
def fill_to_width(text):
|
||||||
|
result = ""
|
||||||
|
for line in text.splitlines():
|
||||||
|
result += textwrap.fill(line, width = WIDTH) + "\n"
|
||||||
|
return result.strip()
|
||||||
|
|
||||||
|
def phase1():
|
||||||
|
"""
|
||||||
|
(0) Do first/last lines before formatting to width
|
||||||
|
(1) Combine output and error (if present) files
|
||||||
|
(2) Format all output to width limit
|
||||||
|
(3) Add closing '*/'
|
||||||
|
"""
|
||||||
|
for outfile in Path(".").rglob("*.out"):
|
||||||
|
out_text = adjust_lines(outfile.read_text())
|
||||||
|
phase_1 = outfile.with_suffix(".p1")
|
||||||
|
with phase_1.open('w') as phs1:
|
||||||
|
phs1.write(fill_to_width(out_text) + "\n")
|
||||||
|
errfile = outfile.with_suffix(".err")
|
||||||
|
if errfile.exists():
|
||||||
|
phs1.write("___[ Error Output ]___\n")
|
||||||
|
phs1.write(fill_to_width(errfile.read_text()) + "\n")
|
||||||
|
phs1.write("*/\n")
|
||||||
|
|
||||||
|
|
||||||
|
########### Chain of Responsibility Match Finder #######################
|
||||||
|
|
||||||
|
def exact_match(text): return text
|
||||||
|
|
||||||
|
memlocation = re.compile("@[0-9a-z]{5,7}")
|
||||||
|
|
||||||
|
def ignore_memory_addresses(text):
|
||||||
|
return memlocation.sub("", text)
|
||||||
|
|
||||||
|
datestamp1 = re.compile(
|
||||||
|
"(?:[MTWFS][a-z]{2} ){0,1}[JFMASOND][a-z]{2} \d{1,2} \d{2}:\d{2}:\d{2} [A-Z]{3} \d{4}")
|
||||||
|
datestamp2 = re.compile(
|
||||||
|
"[JFMASOND][a-z]{2} \d{1,2}, \d{4} \d{1,2}:\d{1,2}:\d{1,2} (:?AM|PM)")
|
||||||
|
|
||||||
|
def ignore_dates(text):
|
||||||
|
for pat in [ datestamp1, datestamp2 ]:
|
||||||
|
text = pat.sub("", text)
|
||||||
|
return text
|
||||||
|
|
||||||
|
def ignore_digits(input_text):
|
||||||
|
return re.sub("-?\d", "", input_text)
|
||||||
|
|
||||||
|
def sort_lines(input_text):
|
||||||
|
return "\n".join(sorted(input_text.splitlines())).strip()
|
||||||
|
|
||||||
|
def sort_words(input_text):
|
||||||
|
return "\n".join(sorted(input_text.split())).strip()
|
||||||
|
|
||||||
|
def unique_lines(input_text):
|
||||||
|
return "\n".join(sorted(list(set(input_text.splitlines()))))
|
||||||
|
|
||||||
|
# Fairly extreme but will still reveal significant changes
|
||||||
|
def unique_words(input_text):
|
||||||
|
return "\n".join(sorted(set(input_text.split())))
|
||||||
|
|
||||||
|
# Fairly extreme but will still reveal significant changes
|
||||||
|
word_only = re.compile("[A-Za-z]+")
|
||||||
|
def words_only(input_text):
|
||||||
|
return "\n".join(
|
||||||
|
sorted([w for w in input_text.split()
|
||||||
|
if word_only.fullmatch(w)]))
|
||||||
|
|
||||||
|
def no_match(input_text): return True
|
||||||
|
|
||||||
|
# Chain of responsibility:
|
||||||
|
strategies = [
|
||||||
|
# Filter Retain result for rest of chain
|
||||||
|
(exact_match, False),
|
||||||
|
(ignore_dates, True ),
|
||||||
|
(ignore_memory_addresses, True ),
|
||||||
|
(sort_lines, False),
|
||||||
|
(ignore_digits, False),
|
||||||
|
(sort_words, False),
|
||||||
|
(unique_lines, False),
|
||||||
|
(unique_words, False),
|
||||||
|
(words_only, False),
|
||||||
|
(no_match, False),
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
class Validator(defaultdict): # Map of lists
|
||||||
|
compare_output = Path(".") / "compare_output.bat"
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__(list)
|
||||||
|
if Validator.compare_output.exists():
|
||||||
|
Validator.compare_output.unlink()
|
||||||
|
for strategy, retain in strategies:
|
||||||
|
strat_batch = Path(strategy.__name__ + ".bat")
|
||||||
|
if strat_batch.exists():
|
||||||
|
strat_batch.unlink()
|
||||||
|
|
||||||
|
def find_output_match(self, javafile, embedded_output, generated_output):
|
||||||
|
for strategy, retain in strategies:
|
||||||
|
filtered_embedded_output = strategy(embedded_output)
|
||||||
|
filtered_generated_output = strategy(generated_output)
|
||||||
|
if filtered_embedded_output == filtered_generated_output:
|
||||||
|
strat_name = strategy.__name__
|
||||||
|
self[strat_name].append(str(javafile))
|
||||||
|
if strat_name is "exact_match": return
|
||||||
|
tfile = javafile.with_suffix("." + strat_name)
|
||||||
|
with Path(strat_name + ".bat").open('a') as strat_batch:
|
||||||
|
strat_batch.write("subl " + str(tfile) + "\n")
|
||||||
|
with Validator.compare_output.open('a') as batch:
|
||||||
|
batch.write("subl " + str(tfile) + "\n")
|
||||||
|
with tfile.open('w') as trace_file:
|
||||||
|
trace_file.write(str(embedded_output) + "\n\n")
|
||||||
|
trace_file.write("=== Actual ===\n\n")
|
||||||
|
trace_file.write(str(generated_output))
|
||||||
|
return
|
||||||
|
if retain:
|
||||||
|
embedded_output = filtered_embedded_output
|
||||||
|
generated_output = filtered_generated_output
|
||||||
|
|
||||||
|
def display_results(self):
|
||||||
|
log = open("verified_output.txt", 'w')
|
||||||
|
for strategy, retain in strategies:
|
||||||
|
key = strategy.__name__
|
||||||
|
if key is "exact_match":
|
||||||
|
for java in self[key]:
|
||||||
|
print(java)
|
||||||
|
elif key in self:
|
||||||
|
log.write("\n" + (" " + key + " ").center(45, "=") + "\n")
|
||||||
|
for java in self[key]:
|
||||||
|
log.write(java + "\n")
|
||||||
|
log.close()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
clean()
|
phase1() # Generates '.p1' files
|
||||||
jfiles = sorted([java.name for java in Path(".").glob("**/*.java")])
|
find_output = re.compile(r"/\* (Output:.*)\*/", re.DOTALL)
|
||||||
duplicates = sorted([x for x, y in collections.Counter(jfiles).items() if y > 1])
|
validator = Validator()
|
||||||
if duplicates:
|
for outfile in Path(".").rglob("*.p1"):
|
||||||
print("Duplicates:")
|
javafile = outfile.with_suffix(".java")
|
||||||
pprint.pprint(duplicates)
|
if not javafile.exists():
|
||||||
|
print(str(outfile) + " has no javafile")
|
||||||
count = 0
|
sys.exit(1)
|
||||||
for output in itertools.chain(Path(".").glob("**/*.out"), Path(".").glob("**/*.err")):
|
javatext = javafile.read_text()
|
||||||
duet = Duet(output)
|
if "/* Output:" not in javatext:
|
||||||
# if duet.error:
|
print(str(outfile) + " has no /* Output:")
|
||||||
# os.system("subl {}".format(duet.java_path))
|
sys.exit(1)
|
||||||
trace("duet.ignore:", duet.ignore, duet.java_path )
|
validator.find_output_match(javafile,
|
||||||
if duet.ignore:
|
find_output.search(javatext).group(0).strip(),
|
||||||
continue
|
outfile.read_text().strip())
|
||||||
v = duet.validate()
|
validator.display_results()
|
||||||
if v is Valid.fail:
|
os.system("more verified_output.txt")
|
||||||
with Path("validate_failures.txt").open('a') as vf:
|
|
||||||
print(duet, file = vf)
|
|
||||||
with Path("strategies.txt").open('a') as st:
|
|
||||||
print(' "' + duet.java_path.name + '" : IgnoreSortedLines(),', file = st)
|
|
||||||
with Path("update_output.bat").open('a') as uo:
|
|
||||||
print('call no ' + str(duet.out_path.with_suffix(".new")), file = uo)
|
|
||||||
with Path("edit_errors.bat").open('a') as eo:
|
|
||||||
print('subl ' + str(duet.java_path), file = eo)
|
|
||||||
if duet.error:
|
|
||||||
duet.out_path.with_suffix(".new").write_text(duet.generated_un_adjusted)
|
|
||||||
os.system('subl ' + str(duet.out_path.with_suffix(".new")))
|
|
||||||
else:
|
|
||||||
with Path("validate_successes.txt").open('a') as vs:
|
|
||||||
print("{:<20}".format(v) + "{}".format(duet.java_path), file = vs)
|
|
||||||
count += 1
|
|
||||||
print("\n" + " Verified files = {} ".format(count).center(60, "*"))
|
|
||||||
|
|
||||||
if Path("validate_failures.txt").exists():
|
|
||||||
os.system("subl "
|
|
||||||
"update_output.bat "
|
|
||||||
"edit_errors.bat "
|
|
||||||
"strategies.txt "
|
|
||||||
"validate_successes.txt "
|
|
||||||
"validate_failures.txt")
|
|
||||||
else:
|
|
||||||
print("\n" + " No Output Errors ".center(60, "="))
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user