# Unit Testing ChatGPT Prompts: Introducing Riteway for SudoLang

DevFeed: [Unit Testing ChatGPT Prompts: Introducing Riteway for SudoLang](<https://devfeed.tech/articles/unit-testing-chatgpt-prompts-introducing-riteway-for-sudolang-20720.md>)

Original publisher: [Read original article](<https://medium.com/javascript-scene/unit-testing-chatgpt-prompts-introducing-riteway-for-sudolang-52761c34abc4?source=rss----c0aeac5284ad---4>)

Author: Eric Elliott

Published: 2023-04-03T21:11:26Z

Content type: article

Language: en

Sources: [Eric Elliot](<https://devfeed.tech/sources/eric-elliot.md>)

Topics: [Testing](<https://devfeed.tech/topics/testing.md>), [Unit testing](<https://devfeed.tech/topics/unit-testing.md>), [Test-driven development](<https://devfeed.tech/topics/tdd.md>), [Artificial Intelligence](<https://devfeed.tech/topics/ai.md>), [Language models](<https://devfeed.tech/topics/language-models.md>), [ChatGPT](<https://devfeed.tech/topics/chatgpt.md>), [Inference](<https://devfeed.tech/topics/inference.md>), [Requirements](<https://devfeed.tech/topics/requirements.md>), [Prompt Engineering](<https://devfeed.tech/topics/prompt-engineering.md>)

Tags: [ai](<https://devfeed.tech/tags/ai.md>), [chatgpt](<https://devfeed.tech/tags/chatgpt.md>), [framework](<https://devfeed.tech/tags/framework.md>), [javascript](<https://devfeed.tech/tags/javascript.md>), [machine-learning](<https://devfeed.tech/tags/machine-learning.md>), [programming-language](<https://devfeed.tech/tags/programming-language.md>), [requirements](<https://devfeed.tech/tags/requirements.md>), [tdd](<https://devfeed.tech/tags/tdd.md>), [technology](<https://devfeed.tech/tags/technology.md>), [testing](<https://devfeed.tech/tags/testing.md>), [tests](<https://devfeed.tech/tags/tests.md>), [unit-testing](<https://devfeed.tech/tags/unit-testing.md>)

## AI overview

The article introduces Riteway for SudoLang, a testing framework for unit-testing prompts and AI-generated outputs. It describes using constraints, requirements, and warnings to help language models produce code and tests that better satisfy specified requirements.

## Source excerpt

Running Riteway's usage example tests in SudoLang running on ChatGPT using GPT-4 I have been a long-time advocate of Test-Driven Development (TDD) because of its many productivity and quality benefits. You can read more about those in "TDD Changed My Life". When I realized that GPT-4 was capable of following complex instructions, one of the first things I thought of was trying to unit test prompts. To do that, I needed more precise control over the prompts. SudoLang is a powerful natural language, constraint-based pseudocode language for GPT-4 and other language model AIs. Since language model outputs can vary significantly and sometimes lack determinism, unit tests play a pivotal role in guaranteeing that the model adheres to all software requirements while generating implementations. Riteway has been my testing framework of choice since we built it during the development of educational software to test student code. With SudoLang, Riteway becomes even more powerful by allowing the language model to provide intelligent feedback on the quality of your tests, and by using intelligent inference to produce quality unit tests for non-deterministic AI-generated outputs. Constraints in SudoLang SudoLang is a constraint-based programming language inspired by the constraints in Ivan Sutherland's Sketchpad. In SudoLang, a constraint is a predefined condition or rule that the model should follow when generating and interpreting code. Constraints help improve the accuracy and relevance of the code functionality, ensuring that it meets the specified requirements. Constraints combine with AI's omnipotent inference to automatically and dynamically synchronize related state changes in SudoLang programs. A lot of the magic in Riteway for SudoLang comes from the powerful, AI-inferred omnipotent constraint solving. Riteway for SudoLang: Built-in Constraints, Requirements, and Warnings Riteway for SudoLang goes beyond traditional testing by incorporating constraints, requirements, and