Project 2 Test Samples
计算机project代写 Hi everyone! Here are a few example test cases that the autograder may run to check your submission when you get started.
Hi everyone! Here are a few example test cases that the autograder may run to check your submission when you get started. If you’re failing some test cases and you’re not sure why. Please check if your submission can pass the sample test cases below:
Project 2a 计算机project代写
- Running your shell and pressing Ctrl+D should result in your shell exiting.
- Running your shell and typing echo hi should result in hi being printed.
- You should be able to combine pipes and arguments. For example, running echo hello world > out.txt should result in a file named out.txt with hello
world as the contents. - Running a command like cat < out > out should delete all of the contents in the file named “out” (don’t delete the file itself!).
- Running a command like cat < a > b should copy the contents of a into b.
- Any invalid sequence of operators, like cat < a < b < c, cat < > < > cat, or cat > a > b > c, should result in an error message being printed with the
word invalid in it.
Project 2b 计算机project代写
One-line test
- Running a command like ls -l -a /usr | head -5 should result in 5 entries of files/folders in the /usr folder being printed with details.
- A complex pipeline, like cat < input.txt | cat > output.txt should copy the contents of the input.txt file to the output.txt file.
- Running a command like ls > out should result in a file called out being created with the output of the ls command as the contents of the file.
- Running a command like ls | cat < input should result in an error message being printed with the word invalid.
- Graceful recovery when typing in invalid input. For example, when autograder types in >>>> or ls > < out into your shell as the command, not only should you successfully print out an error message, you need to also avoid crashing right after.
You should also ensure that your shell can execute absolute and relative commands.For example, in addition to executing ls, your shell should be able to handle /bin/ls. If you make a script called example.sh in the same folder as your shell, you should be able to run ./example.sh in your shell to execute the script.
Composed test 计算机project代写
1. Truncate by cat
After running the following commands, you should get a hello on the console.
2. Arguments with a pipe
After running the following commands, you should see “.” followed by a line of “..” on the command line.
3. Arguments with a pipe and redirection
After running the following commands, you should see the full info of the folder content from the command line as if you have run ls -la.