1+ function Assert-MatchTests {
2+ param (
3+ [Parameter (Mandatory = $true , ValueFromPipeline )] $TestResult
4+ )
5+
6+ if ($TestResult ) {
7+ Write-Error " Output does not match expected results."
8+ }
9+ }
10+
11+ $Error.clear ()
12+ # javac -cp .:json.jar PokeApiApp.java *.java &&
13+ # javac old\*.java &&
14+ java - ea " $PSScriptRoot \AnagramApp.java" rats |
15+ Compare-Object (Get-Content " $PSScriptRoot \..\test\rats_heap_expected" ) |
16+ Assert-MatchTests &&
17+ java - ea " $PSScriptRoot \AnimalChorusExample.java" &&
18+ java - ea " $PSScriptRoot \AnimalsApp.java" &&
19+ java - ea " $PSScriptRoot \ArithmeticSequenceExample.java" &&
20+ java - ea " $PSScriptRoot \BillionDollarMistakeExample.java" &&
21+ java - ea " $PSScriptRoot \CircleApp.java" &&
22+ java - ea " $PSScriptRoot \EqualsExample.java" &&
23+ java - ea " $PSScriptRoot \EvenSquareSummer.java" &&
24+ java - ea " $PSScriptRoot \IntrospectionExample.java" &&
25+ java - ea " $PSScriptRoot \InvarianceExample.java" &&
26+ java - ea " $PSScriptRoot \ListAndSetExample.java" &&
27+ java - ea " $PSScriptRoot \MinMaxTester.java" &&
28+ java - ea " $PSScriptRoot \OptionalExample.java" &&
29+ java - ea " $PSScriptRoot \PairExample.java" &&
30+ java - ea " $PSScriptRoot \PermutationsApp.java" I like carrots |
31+ Compare-Object (Get-Content " $PSScriptRoot \..\test\carrots_expected" ) |
32+ Assert-MatchTests &&
33+ # java -cp .:json.jar PokeApiApp &&
34+ java - ea " $PSScriptRoot \PrimePrinterApp.java" &&
35+ java - ea " $PSScriptRoot \RaceConditionExample.java" &&
36+ java - ea " $PSScriptRoot \ReflectionExample.java" &&
37+ java - ea " $PSScriptRoot \SheepAdder.java" &&
38+ Get-Content " $PSScriptRoot \..\test\wnba_input" |
39+ java - ea " $PSScriptRoot \TopTenScorersApp.java" |
40+ Compare-Object (Get-Content " $PSScriptRoot \..\test\wnba_expected" ) |
41+ Assert-MatchTests &&
42+ Get-Content " $PSScriptRoot \..\test\wordcount_ascii_input" |
43+ java - ea " $PSScriptRoot \TraditionalWordCountApp.java" |
44+ Compare-Object (Get-Content " $PSScriptRoot \..\test\wordcount_ascii_expected" ) |
45+ Assert-MatchTests &&
46+ java - ea " $PSScriptRoot \TripleApp.java" |
47+ Compare-Object (Get-Content " $PSScriptRoot \..\test\triple_expected" ) |
48+ Assert-MatchTests &&
49+ java - ea " $PSScriptRoot \TwiceExample.java" &&
50+ java - ea " $PSScriptRoot \TypeExperiment.java" &&
51+ java - ea " $PSScriptRoot \VariableExample.java" &&
52+ Get-Content " $PSScriptRoot \..\test\wordcount_ascii_input" |
53+ java - ea " $PSScriptRoot \WordCountApp.java" |
54+ Compare-Object (Get-Content " $PSScriptRoot \..\test\wordcount_ascii_expected" ) |
55+ Assert-MatchTests &&
56+ ForEach-Object ' foo'
57+
58+ if ($Error -or ! $? ) {
59+ " *** JAVA TESTS FAILED ***"
60+ }
61+ else {
62+ " JAVA TESTS PASSED"
63+ }
0 commit comments