All Questions
Tagged with tdd or unit-testing
1,047 questions
4
votes
1
answer
125
views
Creating Dedicated Database for database test cases (Tests that I need to check the data are written or read sucessfully) in phpunit
I am making a base test class that bootstraps database Test cases
...
2
votes
2
answers
127
views
C++20 Performance Test Code Generator
My previous question about a generic dictionary class for C++ raised some valid concerns. I have made some modifications based on the previous review, but it needs extensive testing and further ...
5
votes
1
answer
419
views
FORTRAN90 test suite for Project Euler
The intent of this test file is to go through each of my Project Euler solutions and see if they:
return the correct answer, and
do so in under 60 seconds (unless expected otherwise).
I am using ...
0
votes
0
answers
126
views
Fuzz-test the performance of SmokeDetector's keywords regex
I had an idea for attempting to detect bad performing regexes in Charcoal-SE/SmokeDetector, by using Atheris (a fuzzer for python code).
The theory behind it is that a bad performing regex will most ...
3
votes
1
answer
138
views
Testing framework with a single assertion macro
I usually use the Catch2 testing framework in my C++ projects. Unlike other frameworks, it has only one core assertion macro for all comparisons. Instead of writing ...
3
votes
1
answer
44
views
Swift: Mocking a REST API-request
I have read the last two days through several tutorials about how to mock a HTTP-request against a REST API.
Finally I made a prototype for applying, what I have understood from the tutorials.
Here's ...
1
vote
1
answer
104
views
Project for reading and printing IPs
It's a small project which consists of Ip class and functions for reading and printing IPs, unit tests for this code, and a driver app. The driver app is just ...
1
vote
0
answers
28
views
unit testing with test double for DataLakeDirectoryClient object of Azure Storage Files DataLake
I want test review on my unit test code. As I got feeling like this unit test code given in Listing 2 is quite not trustworthy.
My production code(Listing 1) is accessing or precisely downloading the ...
3
votes
0
answers
347
views
Fluent VBA: Two (Almost Three) Years Later
Part 1 - A fluent unit testing framework in VBA: A fluent unit testing framework in VBA
Part 2 - Fluent VBA: One Year Later: Fluent VBA: One Year Later
Two (almost three) years have now passed since I ...
2
votes
0
answers
49
views
Testing PHP CodeIgniter 3 controller with PHPUnit
I want to unit test my PHP website, which uses the outdated framework CodeIgniter 3. CodeIgniter 3 uses the MVC pattern, and each page on the website corresponds to a public method in a controller.
I ...
3
votes
1
answer
92
views
Build a dictionary from a string by the extraction of data from all the pairs <TAG|VAL> contained inside the string and clean string from TAGs
I have written code to manage a string and retrieve from it a dictionary which must contain pairs key-value dependent from the string.
To be more clear I'll show ...
1
vote
0
answers
64
views
General Purpose Utility Constants, Macros, and Functions
Overview:
I have bundled together different macros and functions I often require in different projects into a single compilation unit (utils.h and ...
1
vote
1
answer
59
views
Generic Min() for Integer Types (including Boolean)
This is a follow-up to Generic Max() for Integer Types (including Boolean) and An Attempt at Creating Generic Min()/Max() for Fundamental Types.
What's new:
MIN(), ...
8
votes
2
answers
178
views
Generic Max() for Integer Types (including Boolean)
This is a follow-up to An Attempt at Creating Generic min()/max() for Fundamental Types.
What's Changed:
MIN() has been forsaken for the time being.
Mixed types ...
0
votes
0
answers
18
views
Stub-Based Unit Testing 5 Read Routines (revision)
This is a follow up to: Stub-Based Unit Testing 5 Read Routines.
What's Changed:
OP's goal of reducing the source files' count has been achieved. There is now a single test source instead of 18 ...
4
votes
3
answers
151
views
Stub-Based Unit Testing 5 Read Routines
Requirements:
Following are the functions I need to test, along with the cases where they can fail:
...
5
votes
1
answer
190
views
Unit Tests for an Arena Allocator
In my last post about the allocator, I received some comments about unit-tests:
The code looks correct on the majority of the cases, I will suggest run valgrind or define a good set of unit tests ...
1
vote
2
answers
101
views
simple Text Table utility
A small utility to print data in an ascii table
TextTable
...
2
votes
2
answers
84
views
Goal: Writing Effective Unit Tests to Ensure a Datetime Conversion To/From Local-UTC Works
As the title lists, I am trying to write an effective unittest suite to ensure that the function that converts a date to UTC from local or vice-versa is doing as planned. But it seems hard because ...
3
votes
1
answer
124
views
A simple unit test library for C - version II
I have improved my code here and it looks like this:
Code
assertlib.h:
...
7
votes
1
answer
830
views
A simple unit test library for C
(This post is followed up by this one.)
I have rolled this simple unit test library for C:
com_github_coderodde_my_assert.h:
...
1
vote
1
answer
69
views
Event manager based on decorators
This module is a simple event manager that works with decorators. I would like feedback on:
Bugs
Any ideas to get rid of the classevent decorator, which ...
5
votes
1
answer
190
views
Testing binary search module, based on bisect
The bisect module can only find the index to insert an element. I created a simple class based on the bisect module for precise searching and covered all the edge cases that came to mind with tests.
...
1
vote
1
answer
54
views
Testing code for An+B microsyntax parsing library
I have a small package that provides some API for playing around with the <An+B> CSS microsyntax. It is 100% type hinted and tested, but doesn't actually have any real/useful features and this ...
5
votes
3
answers
2k
views
Python strong password validator ( with unit test )
Lately, I was studying the concept of unit testing in python, so I have decided to write a imperative strong password validator ( checker ) and also attach a unit test to it.
I would like to know if ...
2
votes
1
answer
271
views
Test suite for population-count function, using random input
For the purpose of this discussion, I have the following function:
...
3
votes
1
answer
84
views
Simulate M random walkers N times and visualize relationship between walker number and grid size
Problem statement: Suppose that n random walkers, starting in the center of an n-by-n grid, move one step at a time, choosing to go left, right, up, or down with equal probability at each step. Write ...
1
vote
2
answers
1k
views
Multi-Client Socket Communication with Thread Pool in C++
I've been working on implementing a multi-client socket communication system with a thread pool in C++. The system comprises three main components: logger.h, socket.h, and thread.h, which handle ...
1
vote
1
answer
218
views
HTTP routing with Mongoose
I'm trying to extend the Mongoose RESTful server example with URL routing.
This code relies on the Mongoose library available here.
This is heavily inspired by the routes class from this question but ...
1
vote
1
answer
144
views
Change unit-test structure to avoid try/except/finally clause
I have 10 or 20 tests with the same structure which I would like to improve. The test itself is nested within a try/except/finally clause to make sure that some of ...
6
votes
3
answers
471
views
Unit testing a Linked List implementation in C++
Recently I wanted to use the gtest library to unit test my program but for some reason, it's incredibly hard to make it work and configure (at least for me it was), ...
4
votes
3
answers
304
views
Money class in python
I have recently created the Money class with a helper class Currency. What do you think about the following code? I created unit ...
0
votes
0
answers
80
views
Generate INSERTs from function parameters with jinja2
I'm writing unit-tests with pytest for sqlite database and reporting functions and I need to arrange them by inserting minimal ...
4
votes
1
answer
284
views
Blocking Queue Class Unit Test
I would like any feedback on making the unit test for a BlockingQueue class more robust or better? improvements to the coding style, use of the ...
3
votes
1
answer
106
views
A singly linked list implementation
Here's yet another implementation of a singly linked list. You may base your review on the following questions:
Review goals:
Is the API well thought of?
Does this design include undefined behavior, ...
-1
votes
1
answer
198
views
Test the log in functionality of a web page with incorrect credentials [closed]
I'm new to playwright, so I'm unsure if this is the correct or best way to go about testing. I basically want multiple tests on the same webpage. I've been able to successfully accomplish this using ...
0
votes
1
answer
55
views
Protein Translation Learning Exercise from exercism.org
I'm learning Rust by solving exercises from different tracks on Exercism.
The below code is an implementation of "Protein Translation" from the Python track. I split ...
0
votes
1
answer
136
views
Unit testing and alternative to mocking in Haskell
Let's say you have a simple pure function that applies a discount of 30% if the total price of a list of Items is over 30.00 (let's not delve into the fact that I'm ...
1
vote
1
answer
80
views
N dimensional array index utility Improved
This is a continuation from a previous question; I updated the code with the suggestions and added an additional iteration.
Templates are not an option because of the usage: The objects are stored as ...
4
votes
2
answers
2k
views
Clean up directories and files when a unit test fails
While running unit tests (most of them integration tests) with Python I create some directories. They need to be deleted after the test or when the test fails. The execution of the cleanup code need ...
4
votes
1
answer
1k
views
Transliterate between Cyrillic and Latin scripts
I want to get a code review on the following transliteration code. I wrote it because there were some libraries that I have tried and they were specifically failing with the name "Yuliya" ...
4
votes
0
answers
205
views
Fluent VBA: One Year Later
A little over a year ago, I asked for feedback on Code Review for a unit testing framework I created in VBA. Development of this project has been off and on for the past year. Sometimes I wouldn't ...
4
votes
2
answers
680
views
Unit testing for a multi-dimensional array class
I have designed a class bunji::Tensor which is a multi-dimensional array. I have designed it to have a similar interface to a multi-dimensional ...
4
votes
1
answer
187
views
Python unit tests for storing and loading objects
I wrote some code and thought I may get better with some feedback. I program for almost 5 years, mainly in python.
I care most about the unit testing.
I am not really sure, how industry standard unit ...
2
votes
2
answers
132
views
Astronomical calculations in C for python bindings
I've started teaching myself c/c++ with the intent of being able to writing python bindings to c code. I have a c library used ...
3
votes
1
answer
398
views
Unit test for a React click-counting component
Take this basic component using state:
...
3
votes
1
answer
122
views
String / Char Vector Concatenation Performance Comparison in Matlab
Considering the suggestion of using modern string arrays instead of char vectors proposed by Cris Luengo, I am trying to make a code snippet for performance comparison of these two cases.
The ...
1
vote
0
answers
48
views
UPDATE on Newspaper Bill Calculator CLI with Python (3 of 3, Database)
Code is posted after explanation.
Due to the size of the project, this is being posted in three separate posts. This also ensures each post is more focused.
Post 1 of 3, Core: UPDATE 1 on Newspaper ...
1
vote
2
answers
88
views
UPDATE on Newspaper Bill Calculator CLI with Python (1 of 3, Core)
Code is posted after explanation.
Due to the size of the project, this is being posted in three separate posts. This also ensures each post is more focused.
Post 2 of 3, CLI: UPDATE 1 on Newspaper ...
2
votes
0
answers
70
views
Get ffmpeg command to encode video in x265 codec and downscale to `max_height` resolution
I'm translating the python program video-diet as I am learning rust. The program is to recursively compress video files in a directory, but here I'm just preparing ...