Project 1 Stories

CS 498-598, Extreme Programming - Summer 2001


Story 1

Write a program called mail-strip that reads from std-in a mailbox in stupid UNIX format and strips out the MIME attachments. The mailbox without the stripped attachments is written to std-out.

The command-line option -f mbox-name directs mail-strip to read the mailbox from the file named mbox-name rather than from std-in.

The mailbox file is in BSD "From " format.

Acceptance Tests

Run a mailbox containing attachments through mail-strip. Verify the file sent to std-out is still in stupid UNIX format and contains no attachments.

Run /dev/null through mail-strip. Verify nothing bad happens.

Run a non-mailbox file through mail-strip. Verify the output is identical to the input.

Story 2

An attachment stripped from a mailbox should be written to a file, the name of which is given by the filename or name field in the attachment's MIME header (if both filename and name appear, use filename).

If an attachment doesn't have a name or filename field, it should not be stripped from the mail message; unnamed attachments should be left as part of the mail message.

The saved attachment file should be written to the directory in which mail-strip is running. The command-line option -d save-directory causes the attachment files to be written to the directory save-directory; mail-strip should terminate with an error if save-directory doesn't exist.

Acceptance Tests

Create a mailbox file containing four attachments, one for each possible combination of having or not having a name or filename MIME header field (the names should be different in each attachment). Run the mailbox through mail-strip and verify the proper saved files get created in the current directory.

Run the mailbox from the acceptance tests for story 1 through mail-strip, saving the files into the directory ~/attachments. Verify the proper files have been created in ~/attachments.

Run the mailbox from the acceptance tests for story 1 through mail-strip, saving the files into the directory /this-directory-does-not-exist. Verify nothing bad happens.

Story 3

The mail-strip command-line option -r action determines how mail-strip deals with duplicate attachment files. The acceptable values for action, and the associated actions, are

Acceptance Tests

Take the mailbox from the acceptance tests for story 1 and make all names and filenames the same. Run the mailbox through mail-strip three times, one for each possible value of the -r option. Verify the correct things happened in each case.

Story 4

The function used to determine if one attachment file is the duplicate of another should have the prototype
bool compare(const string & afn1, const string & afn2);
where afn1 is the name (and path, if any) of one of the attachment files and afn2 is the name (and path, if any) of the other attachment files. compare() should return true if the two files are duplicates and false otherwise.

Acceptance Tests

Replace compare() with a version that always returns false. Verify the saved-file names when the mailbox from the acceptance tests for story 3 gets run through mail-strip with the -r rename option.

Replace compare() with a version that always returns true. Verify the saved-file names when the mailbox from the acceptance tests for story 1 gets run through mail-strip with the -r rename option.


This page last modified on 3 July 2001.