EUT03: Unit Testing to Evaluate LLM-Generated Code

Assignment Context

This assignment is part of the Unit Testing Module, where you will apply unit testing methodologies to evaluate AI-generated code. You will use Jest and TypeScript to write comprehensive test suites that verify the correctness of LLM-generated implementations.

Purpose

This assignment challenges you to critically examine and find faults or issues with code generated by Large Language Models (LLMs) such as ChatGPT and Copilot. Rather than simply accepting AI-generated code, you are encouraged to question its correctness, assess the extent to which it adheres to the requirements, identify its limitations, and reflect on how these tools impact software engineering practice. You will experience both the strengths and weaknesses of LLMs and gain insight into the importance of critical evaluation when using AI for code generation.

By completing this assignment, you will be in a better position to:

Objective

This assignment is not just about writing correct code. It is about evaluating the output of a Large Language Model (LLM) through the lens of unit testing, understanding its strengths and limitations, and learning how to critically assess and improve AI-generated code using comprehensive test coverage.

In this exercise, you will:

Getting Started: A zip file containing skeleton code is provided to help you get started. Extract the contents and follow the setup instructions below.


Setup

  1. Download the provided skeleton code from here
  2. Navigate to the project directory
  3. Install dependencies:
    npm install
    
  4. Verify setup by running:
    npm test
    

Requirements

Implementation

Unit Tests

Validating with Instructor Tests

Note: Do not update your student test cases after seeing the instructor tests. The goal is to understand and fix the LLM implementation, not to retrofit your tests.

Process Documentation

Include a pdf file named llm_notes.pdf that contains:

Prompts Used

Analysis of LLM Output

Debugging and Improvements

(Optional) Linting Notes

Reflections


Submission

Upload the following files to Lamaku:

Note: Remember to download instructor_isValidEmail.test.ts from the link above and place it in your tests/ directory only after you have completed your implementation and written your own tests. These tests serve as a validation tool to help you discover what you or the LLM may have missed.