辅导Java程序、讲解program留学生编程
- 首页 >> Matlab编程 Individual Project: cleave
Deliverable 3
Project Goals
In this project, you will be developing a simple Java application (cleave) using an agile, test-driven process involving multiple deliverables. While you will receive one grade for the entire project, each deliverable must be completed by its own due date, and all deliverables will contribute to the overall project grade.
Specification of the cleave Utility
cleave is a simple command-line utility written in Java with the following specification:
Summary
cleave allows for removing sections from each line of a file
Syntax
cleave OPTIONS FILE
Description
Program cleave prints selected parts of the lines in FILE to stdout, where FILE is the name of the input file and OPTIONS are one or more of the following:
●-c LIST
select only the characters at the indices specified by LIST
●-f LIST
select only the fields at indices specified by LIST; also print any line that contains no delimiter character (default=TAB)
●-d DELIM
use character DELIM instead of TAB as field delimiter (used only with option -f)
Use one and only one of -c or -f. Each LIST consists of either one range or many ranges separated by commas. Selected input is written in the same order that it is read, and is written exactly once. Each range is one of:
●N
Nth character or field, counted from 1.
●N-
from Nth character or field to the end of the line.
●N-M
from Nth to Mth (included) character or field. Where N≤M.
●-M
from first to Mth (included) character or field.
NOTES:
If -d is specified, DELIM must consist of a single character. Selected fields are printed to stdout delimited by DELIM (default=TAB). Delimiter options (-d) are only valid for field selection (-f), and they can appear in either order. There will always be one output line for each input line.
EXAMPLES OF USAGE
(In the following, “↵” represents a newline character, and “→” represents a TAB character.)
Example 1:
cleave -c 2 FILE
input FILE:
0123456789↵
abcdefghi↵
stdout:
1↵
b↵
Example 2: (same as Example 1, but FILE ends without a newline)
cleave -c 2 FILE
input FILE:
0123456789↵
abcdefghi
stdout:
1↵
b↵
Example 3:
cleave -c 15 FILE
input FILE:
0123456789↵
stdout:
↵
Example 4:
cleave -c 15 FILE
input FILE:
0123456789↵
abcdefghi
stdout:
↵
↵
Example 5:
cleave -c 5,1 FILE
input FILE:
0123456789↵
stdout:
04↵
Example 6:
cleave -c -5 FILE
input FILE:
0123456789↵
stdout:
01234↵
Example 7:
cleave -c 4-7 FILE
input FILE:
0123456789
stdout:
3456↵
Example 8:
cleave -c 4-7,2 FILE
input FILE:
0123456789
stdout:
13456↵
Example 9:
cleave -f 2,4 FILE
input FILE:
012→34→5678→9↵
a→b→c→d→e→f→g→h→i
stdout:
34→9↵
b→d↵
Example 10:
cleave -f 2-4 FILE
input FILE:
012→34→5678→9↵
a→b→c→d→e→f→g→h→i
stdout:
34→5678→9↵
b→c→d↵
Example 11:
cleave -f 2-4 -d : FILE
input FILE:
012:34:5678:9↵
a:b:c:d:e:f:g:h:i
stdout:
34:5678:9↵
b:c:d↵
Example 12:
cleave -d : -f 2-4 FILE
input FILE:
012:34:5678:9↵
a:b:c:d:e:f:g:h:i
stdout:
34:5678:9↵
b:c:d↵
Example 13:
cleave -f 3- -d , FILE
input FILE:
012,34,5678,9↵
a,b,c,d,e,f,g,h,i↵
stdout:
5678,9↵
c,d,e,f,g,h,i↵
Example 14:
cleave -f 2-4,3 -d : FILE
input FILE:
012:34:5678:9↵
a:b:c:d:e:f:g:h:i
stdout:
34:5678:9↵
b:c:d↵
Example 15:
cleave -f 10 FILE
input FILE:
012→34→5678→9↵
a→b→c→d→e→f→g→h→i
stdout:
↵
↵
Deliverables Summary
This part of the document is provided to help you keep track of where you are in the individual project and will be updated in future deliverables.
DELIVERABLE 1 (done)
●Provided:
○cleave specification
○Skeleton of the main class for cleave
○Example tests and skeleton of the test class to submit
○JUnit libraries
●Expected:
○Part I (Category Partition)
■catpart.txt: TSL file you created
■catpart.txt.tsl: test specifications generated by the TSLgenerator tool when run on your TSL file.
○Part II (Junit Tests)
■Junit tests derived from your category partition test frames (MyMainTest.java)
DELIVERABLE 2 (done)
●Provided:
○Reference implementation of cleave utility (through Gradescope)
●Expected:
○Possibly revised set of tests that (1) pass on the reference implementation, (2) cover a set of scenarios (provided through Gradescope), and (3) have suitable oracles.
DELIVERABLE 3 (this deliverable, see below for details)
●Provided:
○Instructor-provided test cases for cleave (through Gradescope)
●Expected:
○Implementation of cleave that passes all the student-provided and instructor-provided test cases.
DELIVERABLE 4
●provided: TBD
●expected: TBD
Deliverable 3: Instructions
In this deliverable, you will provide your own implementation of the cleave utility. Your implementation must pass all of the test cases that you submitted as part of Deliverable 2. In addition, we will assume that someone else in your team developed a set of additional test cases, independently from you. Your code will also have to pass these additional tests. Please note that these tests all pass on the reference implementation we provided for Deliverable 2, so they should be “compatible” with your own tests (as long as they passed in Deliverable 2).
Grade
Your grade for this deliverable will consist of two parts:
●30% of your grade will be proportional to the percentage of your test cases that pass on your implementation. We expect everybody to get full points on this part, as it only involves your tests and your code.
●The remaining 70% of your grade will be proportional to the percentage of the instructor-provided test cases that pass on your implementation. For example, if your implementation passes 80 of the 100 provided test cases, your grade for this part will be 70 * 80 / 100 = 56.
Committing and Submitting the Deliverable
●As usual, commit and push your code to your individual, assigned private repository. Important: make sure not to modify or remove any of the tests that you submitted for D2. Although for practical reasons the autograder does not check for that, we perform that check offline before finalizing the grades.
●Make sure that all Java files and necessary libraries are committed and pushed.
●As you did for Deliverable 1 and 2, you can check that you committed and pushed all the files you needed by doing the following:
○Clone a fresh copy of your personal repo in another directory
○Go to directory IndividualProject/cleave in this fresh clone
○Compile your code. One way to do is to run, from a Unix-like shell:
javac -cp lib/\* -d classes src/edu/gatech/seclass/cleave/*.java test/edu/gatech/seclass/cleave/*.java
(on some platforms, you may need to first create directory “classes”)
○Run your tests. Again, from a Unix-like shell, you can run:
java -cp classes:lib/\* org.junit.runner.JUnitCore edu.gatech.seclass.cleave.MyMainTest[ If using a Windows-based system, you may need to run java -cp "classes;lib/*" org.junit.runner.JUnitCore edu.gatech.seclass.cleave.MyMainTest instead.]
○All of your tests should pass.
●Submit on gradescope a file, called submission.txt that contains, in two separate lines (1) your GT username and (2) the commit ID for your submission. For example, the content of file submission.txt for George P. Burdell could look something like the following:
submission.txt
gpburdell1
81b2f59
●As soon as you submit, Gradescope will grade your submission by:
○Making sure that your files are present and in the correct location.
○Performing the same sanity checks it performed in D1 and D2.
○Compiling and running your tests and the instructor-provided tests against your implementation of cleave.
If any of the above steps fails, you will see a grade of 0 and an error message with some diagnostic information. Please note that, as before, if your submission does not pass the Gradescope checks, it will not be graded and will receive a 0. Conversely, if Gradescope can successfully compile and run your code and both sets of tests, you will immediately receive a grade that is your actual grade for this deliverable (assuming you did not modify your Deliverable 2 tests). Note that you can resubmit as many times as you want before the deadline.
Gradescope Feedback and Requests for Clarifications
Gradescope Feedback
The test case results that you see in Gradescope tell you whether a given test passed or not. If the test didn't pass, Gradescope should show the difference between the expected and actual output. For ease of consumption, that difference may contain ellipses ("...") to make the feedback more compact by omitting common parts of expected and actual output, and use square brackets to map corresponding parts of the output that differ in the expected and actual output.
For example, if the expected output is:
Usage: cleave [-c
Deliverable 3
Project Goals
In this project, you will be developing a simple Java application (cleave) using an agile, test-driven process involving multiple deliverables. While you will receive one grade for the entire project, each deliverable must be completed by its own due date, and all deliverables will contribute to the overall project grade.
Specification of the cleave Utility
cleave is a simple command-line utility written in Java with the following specification:
Summary
cleave allows for removing sections from each line of a file
Syntax
cleave OPTIONS FILE
Description
Program cleave prints selected parts of the lines in FILE to stdout, where FILE is the name of the input file and OPTIONS are one or more of the following:
●-c LIST
select only the characters at the indices specified by LIST
●-f LIST
select only the fields at indices specified by LIST; also print any line that contains no delimiter character (default=TAB)
●-d DELIM
use character DELIM instead of TAB as field delimiter (used only with option -f)
Use one and only one of -c or -f. Each LIST consists of either one range or many ranges separated by commas. Selected input is written in the same order that it is read, and is written exactly once. Each range is one of:
●N
Nth character or field, counted from 1.
●N-
from Nth character or field to the end of the line.
●N-M
from Nth to Mth (included) character or field. Where N≤M.
●-M
from first to Mth (included) character or field.
NOTES:
If -d is specified, DELIM must consist of a single character. Selected fields are printed to stdout delimited by DELIM (default=TAB). Delimiter options (-d) are only valid for field selection (-f), and they can appear in either order. There will always be one output line for each input line.
EXAMPLES OF USAGE
(In the following, “↵” represents a newline character, and “→” represents a TAB character.)
Example 1:
cleave -c 2 FILE
input FILE:
0123456789↵
abcdefghi↵
stdout:
1↵
b↵
Example 2: (same as Example 1, but FILE ends without a newline)
cleave -c 2 FILE
input FILE:
0123456789↵
abcdefghi
stdout:
1↵
b↵
Example 3:
cleave -c 15 FILE
input FILE:
0123456789↵
stdout:
↵
Example 4:
cleave -c 15 FILE
input FILE:
0123456789↵
abcdefghi
stdout:
↵
↵
Example 5:
cleave -c 5,1 FILE
input FILE:
0123456789↵
stdout:
04↵
Example 6:
cleave -c -5 FILE
input FILE:
0123456789↵
stdout:
01234↵
Example 7:
cleave -c 4-7 FILE
input FILE:
0123456789
stdout:
3456↵
Example 8:
cleave -c 4-7,2 FILE
input FILE:
0123456789
stdout:
13456↵
Example 9:
cleave -f 2,4 FILE
input FILE:
012→34→5678→9↵
a→b→c→d→e→f→g→h→i
stdout:
34→9↵
b→d↵
Example 10:
cleave -f 2-4 FILE
input FILE:
012→34→5678→9↵
a→b→c→d→e→f→g→h→i
stdout:
34→5678→9↵
b→c→d↵
Example 11:
cleave -f 2-4 -d : FILE
input FILE:
012:34:5678:9↵
a:b:c:d:e:f:g:h:i
stdout:
34:5678:9↵
b:c:d↵
Example 12:
cleave -d : -f 2-4 FILE
input FILE:
012:34:5678:9↵
a:b:c:d:e:f:g:h:i
stdout:
34:5678:9↵
b:c:d↵
Example 13:
cleave -f 3- -d , FILE
input FILE:
012,34,5678,9↵
a,b,c,d,e,f,g,h,i↵
stdout:
5678,9↵
c,d,e,f,g,h,i↵
Example 14:
cleave -f 2-4,3 -d : FILE
input FILE:
012:34:5678:9↵
a:b:c:d:e:f:g:h:i
stdout:
34:5678:9↵
b:c:d↵
Example 15:
cleave -f 10 FILE
input FILE:
012→34→5678→9↵
a→b→c→d→e→f→g→h→i
stdout:
↵
↵
Deliverables Summary
This part of the document is provided to help you keep track of where you are in the individual project and will be updated in future deliverables.
DELIVERABLE 1 (done)
●Provided:
○cleave specification
○Skeleton of the main class for cleave
○Example tests and skeleton of the test class to submit
○JUnit libraries
●Expected:
○Part I (Category Partition)
■catpart.txt: TSL file you created
■catpart.txt.tsl: test specifications generated by the TSLgenerator tool when run on your TSL file.
○Part II (Junit Tests)
■Junit tests derived from your category partition test frames (MyMainTest.java)
DELIVERABLE 2 (done)
●Provided:
○Reference implementation of cleave utility (through Gradescope)
●Expected:
○Possibly revised set of tests that (1) pass on the reference implementation, (2) cover a set of scenarios (provided through Gradescope), and (3) have suitable oracles.
DELIVERABLE 3 (this deliverable, see below for details)
●Provided:
○Instructor-provided test cases for cleave (through Gradescope)
●Expected:
○Implementation of cleave that passes all the student-provided and instructor-provided test cases.
DELIVERABLE 4
●provided: TBD
●expected: TBD
Deliverable 3: Instructions
In this deliverable, you will provide your own implementation of the cleave utility. Your implementation must pass all of the test cases that you submitted as part of Deliverable 2. In addition, we will assume that someone else in your team developed a set of additional test cases, independently from you. Your code will also have to pass these additional tests. Please note that these tests all pass on the reference implementation we provided for Deliverable 2, so they should be “compatible” with your own tests (as long as they passed in Deliverable 2).
Grade
Your grade for this deliverable will consist of two parts:
●30% of your grade will be proportional to the percentage of your test cases that pass on your implementation. We expect everybody to get full points on this part, as it only involves your tests and your code.
●The remaining 70% of your grade will be proportional to the percentage of the instructor-provided test cases that pass on your implementation. For example, if your implementation passes 80 of the 100 provided test cases, your grade for this part will be 70 * 80 / 100 = 56.
Committing and Submitting the Deliverable
●As usual, commit and push your code to your individual, assigned private repository. Important: make sure not to modify or remove any of the tests that you submitted for D2. Although for practical reasons the autograder does not check for that, we perform that check offline before finalizing the grades.
●Make sure that all Java files and necessary libraries are committed and pushed.
●As you did for Deliverable 1 and 2, you can check that you committed and pushed all the files you needed by doing the following:
○Clone a fresh copy of your personal repo in another directory
○Go to directory IndividualProject/cleave in this fresh clone
○Compile your code. One way to do is to run, from a Unix-like shell:
javac -cp lib/\* -d classes src/edu/gatech/seclass/cleave/*.java test/edu/gatech/seclass/cleave/*.java
(on some platforms, you may need to first create directory “classes”)
○Run your tests. Again, from a Unix-like shell, you can run:
java -cp classes:lib/\* org.junit.runner.JUnitCore edu.gatech.seclass.cleave.MyMainTest[ If using a Windows-based system, you may need to run java -cp "classes;lib/*" org.junit.runner.JUnitCore edu.gatech.seclass.cleave.MyMainTest instead.]
○All of your tests should pass.
●Submit on gradescope a file, called submission.txt that contains, in two separate lines (1) your GT username and (2) the commit ID for your submission. For example, the content of file submission.txt for George P. Burdell could look something like the following:
submission.txt
gpburdell1
81b2f59
●As soon as you submit, Gradescope will grade your submission by:
○Making sure that your files are present and in the correct location.
○Performing the same sanity checks it performed in D1 and D2.
○Compiling and running your tests and the instructor-provided tests against your implementation of cleave.
If any of the above steps fails, you will see a grade of 0 and an error message with some diagnostic information. Please note that, as before, if your submission does not pass the Gradescope checks, it will not be graded and will receive a 0. Conversely, if Gradescope can successfully compile and run your code and both sets of tests, you will immediately receive a grade that is your actual grade for this deliverable (assuming you did not modify your Deliverable 2 tests). Note that you can resubmit as many times as you want before the deadline.
Gradescope Feedback and Requests for Clarifications
Gradescope Feedback
The test case results that you see in Gradescope tell you whether a given test passed or not. If the test didn't pass, Gradescope should show the difference between the expected and actual output. For ease of consumption, that difference may contain ellipses ("...") to make the feedback more compact by omitting common parts of expected and actual output, and use square brackets to map corresponding parts of the output that differ in the expected and actual output.
For example, if the expected output is:
Usage: cleave [-c
- | -f
- [-d
and the actual output is:
Usage: myprogram [-c
- | -f
- [-d
the output in Gradescope could be:
expected:
In cases in which there are completely extra or completely missing parts, the square brackets may be empty (i.e., "[]").
Requests for clarifications
If you need clarifications on a specific test or Gradescope output, please post privately on Piazza (if appropriate, we will make it public) and make sure to add, when applicable:
●a link to the Gradescope results (not the Canvas page for the assignment),
●an inlined, complete copy of the test(s) you reference, if yours (i.e., no screenshots or commit IDs, please), and
●any information that may be relevant.
The bottom line is that, to make the interaction efficient, you should make your posts as self-contained and easy-to-check as possible. The faster we can respond to the posts, the more students we can help.
Notes
●Because of the way the autograder works, we are expecting test class MyMainTest to be self-contained. That is, MyMainTest should not rely on any external classes or resources.
●Make sure not to make calls to System.exit() within your tests, as that creates problems for JUnit.
●You will not be able to see the instructor-provided test cases, but Gradescope will provide details on which of your test cases fail and how. More precisely, it will let you know the difference between expected and actual outputs for the failing tests, which should allow you to fix your code so that it passes all tests.
●Although we tested the autograder, it may still handle some corner cases incorrectly. If you receive feedback that seems to be incorrect, please contact us on Piazza using the approach we describe above.
●If you think you have a legitimate reason to modify your Deliverable 2 tests, reach out to us privately on Piazza and provide all the necessary details. We believe this should not be necessary, but we cannot completely exclude some rare corner cases.