# Unittests

A lightweight JavaScript unit testing library that provides a quick and simple way to write and run unit tests for your code.

## Installation

```bash
npm install unittests
```

## Usage

```javascript
import { run_tests } from 'unittests';

// Define your test cases as arrays of [input, expected_output]
const examples = [
    ['test input 1', 'expected output 1'],
    ['test input 2', 'expected output 2']
];

// Your function to test
function myFunction(input) {
    // Your implementation
    return input;
}

// Run the tests
const results = run_tests(examples, myFunction);

// Print the results
results.print_results();
```

## Features

- Simple and lightweight testing framework
- Easy to write test cases using input/output pairs
- Clear test results output
- Percentage-based test success reporting
- Option to show/hide successful test cases

## API

### run_tests(examples, func)

Runs the test cases and returns a TestResults object.

- `examples`: Array of test cases, where each test case is an array containing [input, expected_output]
- `func`: The function to test

### TestResults

Class that handles test results and reporting.

#### Methods

- `print_results(show_succeeded = false)`: Prints the test results
  - `show_succeeded`: Optional boolean to show successful test cases (default: false)

## License

ISC