Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/shrunsprint89/stringcalculatorkata


https://github.com/shrunsprint89/stringcalculatorkata

Last synced: 17 days ago
JSON representation

Awesome Lists containing this project

README

        

# String Calculator TDD Kata

This repo implements the String Calculator TDD Kata as defined by Roy Osherove (https://osherove.com/tdd-kata-1/). The kata involves creating a string calculator that can handle basic string parsing and addition with various rules and edge cases.

## Getting Started

### Prerequisites

- Python 3.x
- pytest

### Installation

Clone this repository:

```bash
git clone https://github.com/shrunSprint89/stringCalculatorKata.git
cd stringCalculatorKata
```

Install dependencies using pip:

```bash
pip install -r requirements.txt
```

### Running Tests

To run the tests:

```bash
pytest
```

### Using the Calculator

To use the string calculator in your code:

```python
from string_calculator import StringCalculator

calculator = StringCalculator()
result = calculator.Add("1,2,3") # Returns 6
```

The Add method accepts a string input containing numbers separated by commas and returns their sum. See the kata rules for supported formats and special cases.