CPSC 480-010 Software Engineering (SE) Spring 2023

Project 3: TDD

In Project 3: TDD, you will follow a TDD process to implement code submitted via a GitHub Classroom repository. An invitation link to create the repository is on the Brightspace course page.

Due Dates:

The input for a (source) code-analysis project is source code that can come from multiple sources, including solitary files (e.g., main.cpp), directories of source-code files (e.g., src/), source-code archives (e.g., project.tar.gz, file.zip), and standard input (i.e., stdin, e.g., std::cin).

In addition, solitary files and source-code archives can include a URL, e.g., https://raw.githubusercontent.com/UAComputerScience/sorttdd-mlcollard/main/sortTest.cpp

To perform the code analysis, the source code is wrapped in a single XML element with metadata about the source code, including filename, programming language, url, hash, and LOC (lines of code). For the source-code example, the resulting XML has the following attributes:

Attribute XML Example
 language  language="C++"
url url="http://mlcollard.net/fragment.cpp"
filename filename="fragment.cpp"
LOC loc="3"
hash hash="39dcad4f59855aa76420aa3d69af3d7ba30a91bb"

The hash is of the source and is a SHA1 160-bit (20 bytes) represented in 40 hex characters, which Git uses. Note that the xmlns:code="http://mlcollard.net/code" is not an attribute, but an XML namespace declaration, handled automatically by XMLWrapper.

The programming language is typically determined from the file extension, e.g., .cpp for C++, but exceptions exist. The variety of input sources and program options for the metadata follows the rules stated below.


Implement the below rules following a Test-Driven Development (TDD) approach. Write a test in CodeAnalysisTest.cpp, and implement the minimal code necessary to get it working in CodeAnalysis.cpp, refactor/clean up the code to make it clear and logical, then commit with an appropriate commit message. You are encouraged to commit more than once per test case, e.g., after entering the minimal code to solve the problem and refactor/clean up the code.


Error Handling

All error messages are written to standard error (i.e., std::cerr), and the function should return an empty string.


Your score will depend on the following: