001    package ps6.test;
002    
003    import ps6.Address;
004    import ps6.test.TestRecord.TestDB;
005    
006    /**
007     * ValidateQueries contains static fields which hold candidate test queries
008     */
009    public final class ValidateQueries {
010    
011        // test directions when start and end are on the same segment
012        public static final TestRecord testSameSegment = new TestRecord(
013                "testSameSegment", TestDB.TINY,
014                TestRecord.TestType.DRIVING,
015                new Address(800, "SE Pioneer Way", "98277"),
016                new Address(841,"SE Pioneer Way", "98277"),
017                new String[] {
018                        "Turn left onto SE Pioneer Way and go 0.1 miles.",
019                        "841 SE Pioneer Way 98277 is on your right" },
020                        "Trip length: 0.1 miles",
021                        0.07472776589129437, null);
022    
023        // test directions when start and end are on the same street
024        public static final TestRecord testSameStreetWalking = new TestRecord(
025                "testSameStreetWalking", TestDB.TINY,
026                TestRecord.TestType.WALKING,
027                new Address(630, "SE Pioneer Way", "98277"),
028                new Address(940, "SE Pioneer Way", "98277"),
029                new String[] {
030                        "Turn left onto SE Pioneer Way and walk for 5 minutes.",
031                        "940 SE Pioneer Way 98277 is on your left", },
032                        "Trip time: 5 minutes",
033                        0.232764928811733, null);
034    
035        // test directions when start and end are on the same street
036        public static final TestRecord testSameStreetDriving = new TestRecord(
037                "testSameStreetDriving", TestDB.TINY,
038                TestRecord.TestType.DRIVING,
039                new Address(630, "SE Pioneer Way", "98277"),
040                new Address(940, "SE Pioneer Way", "98277"),
041                new String[] {
042                        "Turn left onto SE Pioneer Way and go 0.2 miles.",
043                        "940 SE Pioneer Way 98277 is on your left", },
044                        "Trip length: 0.2 miles",
045                        0.232764928811733, null);
046    
047        // test directions when start and end are on the same zip
048        public static final TestRecord testSameZip = new TestRecord(
049                "testSameZip", TestDB.TINY,
050                TestRecord.TestType.DRIVING,
051                new Address(841, "SE Pioneer Way", "98277"),
052                new Address(1403, "Monroe Landing Rd", "98277"),
053                new String[] {
054                        "Turn left onto SE Pioneer Way and go 0.5 miles.",
055                        "Continue onto W Pioneer Way and go 0.6 miles.",
056                        "Turn slight left onto State Route 20 and go 1.6 miles.",
057                        "Turn left onto Monroe Landing Rd and go 0.2 miles.",
058                        "1403 Monroe Landing Rd 98277 is on your right",},
059                        "Trip length: 2.9 miles",
060                        2.9145611963146507, null);
061    
062        // test the first example from the assignment handout
063        public static final TestRecord testExamplePath1 = new TestRecord(
064                "testExamplePath1", TestDB.TINY,
065                TestRecord.TestType.WALKING,
066                new Address(950, "NW 2nd Ave", "98277"),
067                new Address(473, "SW Fairhaven Dr","98277"),
068                new String[] {
069                        "Turn left onto NW 2nd Ave and walk for 4 minutes.",
070                        "Turn right onto NW Fairhaven Dr and walk for 2 minutes.",
071                        "Turn slight right onto SW Fairhaven Dr and walk for 7 minutes.",
072                        "473 SW Fairhaven Dr 98277 is on your right",},
073                        "Trip time: 13 minutes",
074                        0.6395505841145289, null);
075    
076        // test the second example from the assignment handout
077        public static final TestRecord testExamplePath2 = new TestRecord(
078                "testExamplePath2", TestDB.TINY,
079                TestRecord.TestType.DRIVING,
080                new Address(841, "SE Pioneer Way", "98277"),
081                new Address(1403, "Monroe Landing Rd","98277"),
082                new String[] {
083                        "Turn left onto SE Pioneer Way and go 0.5 miles.",
084                        "Continue onto W Pioneer Way and go 0.6 miles.",
085                        "Turn slight left onto State Route 20 and go 1.6 miles.",
086                        "Turn left onto Monroe Landing Rd and go 0.2 miles.",
087                        "1403 Monroe Landing Rd 98277 is on your right",},
088                        "Trip length: 2.9 miles",
089                        2.9145611963146507, null);
090    
091        // test the second example from the assignment handout
092        public static final TestRecord testExamplePath3 = new TestRecord(
093                "testExamplePath3", TestDB.TINY,
094                TestRecord.TestType.DRIVING,
095                new Address(2430, "Fairway Ln", "98277"),
096                new Address(1614, "Swantown Rd","98277"),
097                new String[] {
098                        "Turn left onto Fairway Ln and go 0.2 miles.",
099                        "Turn sharp left onto Swantown Rd and go 1.1 miles.",
100                        "1614 Swantown Rd 98277 is on your right",},
101                        "Trip length: 1.3 miles",
102                       1.3038780471564961, null);
103    
104    
105        // test for an invalid zip code
106        public static final TestRecord testBadZip = new TestRecord(
107                "testBadZip", TestDB.TINY,
108                TestRecord.TestType.INVALID_ADDRESS,
109                new Address(123, "Bad Zip Code Rd", "12345"),
110                new Address(123, "Bad Zip Code Rd", "12345"),
111                null,null,Double.NaN,
112                "No such zipcode: 123 Bad Zip Code Rd 12345");
113    
114        // test for an invalid street
115        public static final TestRecord testBadStreet = new TestRecord(
116                "testBadStreet", TestDB.TINY,
117                TestRecord.TestType.INVALID_ADDRESS,
118                new Address(123, "Fake St", "98277"),
119                new Address(123, "Fake St", "98277"),
120                null,null,Double.NaN,
121                "No such street: 123 Fake St 98277");
122    
123        // test for an invalid number
124        public static final TestRecord testBadNum = new TestRecord(
125                "testBadNum", TestDB.TINY,
126                TestRecord.TestType.INVALID_ADDRESS,
127                new Address(2000, "Starflower Rd", "98277"),
128                new Address(2000,"Starflower Rd", "98277"),
129                null,null,Double.NaN,
130                "No such number: 2000 Starflower Rd 98277");
131    
132        // test for invalid direction type
133        public static final TestRecord testBadDirType = new TestRecord(
134                "testBadDirType", TestDB.TINY,
135                TestRecord.TestType.INVALID_DIR_TYPE,
136                new Address(841, "SE Pioneer Way", "98277"),
137                new Address(841, "SE Pioneer Way", "98277"),
138                null,null,Double.NaN,
139                "Invalid direction type: q");
140    
141    
142        /** All validation queries **/
143        public static final TestRecord[] allQueries = {
144            testBadZip,
145            testBadStreet,
146            testBadNum,
147            testBadDirType,
148            testSameSegment,
149            testSameZip,
150            testSameStreetWalking,
151            testSameStreetDriving,
152            testExamplePath1,
153            testExamplePath2,
154            testExamplePath3,
155        };
156    
157        //You may want to create other groups of queries, e.g.:
158        //
159        //public static final TestRecord[] badQueries = {
160        //    testBadZip,
161        //  testBadStreet,
162        //  testBadNum,
163        //    testBadDirType,
164        //};
165    }