Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.

Questions tagged [unit-testing]

Use this tag for code whose main focus is high-performance testing of the actual functional code.

Filter by
Sorted by
Tagged with
4 votes
1 answer
168 views

Intro Two \$n\$-strings \$s = \langle s_1 \ldots s_n \rangle \$ and \$z = \langle z_z \ldots z_n \rangle\$ are considered isomorphic if and only if there exists a bijection \$f\$ such that for all \$...
coderodde's user avatar
  • 32.2k
2 votes
0 answers
60 views

(See the previous and initial iteration.) Intro This time, I decided to pack the genomic data such that 4 nucleotide bases are encoded into a single byte. In other words, ...
coderodde's user avatar
  • 32.2k
4 votes
1 answer
78 views

I like from the C++ unit test framework Catch2 its sections -- much more than the xUnit test fixtures. Therefore I wrote me some macros which mimic the Catch2 sections. This is the first macro heavy ...
tommsch's user avatar
  • 293
4 votes
3 answers
198 views

I have a function which requires all parameters to be positive: ...
Idieh's user avatar
  • 73
5 votes
1 answer
386 views

I've been transitioning from type-safe programming languages like Dart and Java to Python, and I'm trying to enforce Domain-Driven Design (DDD) principles in a language that naturally leans towards ...
koussay issaoui's user avatar
4 votes
1 answer
166 views

I am making a base test class that bootstraps database Test cases ...
Dimitrios Desyllas's user avatar
2 votes
2 answers
172 views

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 ...
pacmaninbw's user avatar
  • 26.2k
6 votes
1 answer
458 views

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 ...
Olivia A's user avatar
3 votes
1 answer
154 views

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 ...
elehtine's user avatar
  • 165
3 votes
1 answer
70 views

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 ...
michael.zech's user avatar
  • 5,044
1 vote
1 answer
126 views

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 ...
qloq's user avatar
  • 145
3 votes
0 answers
400 views

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 ...
Brian Gonzalez's user avatar
2 votes
0 answers
62 views

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 ...
RedDragonWebDesign's user avatar
3 votes
1 answer
140 views

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 ...
User051209's user avatar
1 vote
1 answer
118 views

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(), ...
Madagascar's user avatar
  • 10.1k
8 votes
2 answers
267 views

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 ...
Madagascar's user avatar
  • 10.1k
4 votes
3 answers
240 views

Requirements: Following are the functions I need to test, along with the cases where they can fail: ...
Madagascar's user avatar
  • 10.1k
5 votes
1 answer
243 views

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 ...
Madagascar's user avatar
  • 10.1k
1 vote
2 answers
113 views

A small utility to print data in an ascii table TextTable ...
Martin Frank's user avatar
  • 3,033
2 votes
2 answers
115 views

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 ...
0004's user avatar
  • 121
3 votes
1 answer
156 views

I have improved my code here and it looks like this: Code assertlib.h: ...
coderodde's user avatar
  • 32.2k
7 votes
1 answer
852 views

(This post is followed up by this one.) I have rolled this simple unit test library for C: com_github_coderodde_my_assert.h: ...
coderodde's user avatar
  • 32.2k
1 vote
1 answer
96 views

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 ...
rdesparbes's user avatar
5 votes
1 answer
242 views

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. ...
Aycon's user avatar
  • 225
1 vote
1 answer
84 views

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 ...
InSync's user avatar
  • 499
6 votes
3 answers
2k views

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 ...
KhodeNima's user avatar
  • 419
2 votes
1 answer
278 views

For the purpose of this discussion, I have the following function: ...
joseville's user avatar
  • 516
3 votes
1 answer
101 views

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 ...
x27ca61a's user avatar
  • 327
1 vote
2 answers
1k views

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 ...
user avatar
1 vote
1 answer
256 views

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 ...
S Meredith's user avatar
1 vote
1 answer
172 views

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 ...
Mathieu's user avatar
  • 251
6 votes
3 answers
576 views

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), ...
i_hate_F_sharp's user avatar
4 votes
3 answers
418 views

I have recently created the Money class with a helper class Currency. What do you think about the following code? I created unit ...
whiteman808's user avatar
4 votes
1 answer
310 views

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 ...
Simon's user avatar
  • 209
3 votes
1 answer
123 views

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, ...
Madagascar's user avatar
  • 10.1k
-1 votes
1 answer
212 views

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 ...
Aeton's user avatar
  • 3
0 votes
1 answer
71 views

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 ...
Saurabh's user avatar
  • 445
0 votes
1 answer
161 views

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 ...
Jir's user avatar
  • 201
1 vote
1 answer
104 views

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 ...
Dávid Tóth's user avatar
4 votes
2 answers
2k views

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 ...
buhtz's user avatar
  • 219
4 votes
1 answer
2k views

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" ...
nop's user avatar
  • 819
4 votes
0 answers
235 views

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 ...
Brian Gonzalez's user avatar
4 votes
2 answers
705 views

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 ...
finlay morrison's user avatar
4 votes
1 answer
214 views

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 ...
Cjw9000's user avatar
  • 41
2 votes
2 answers
164 views

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 ...
Jason Leaver's user avatar
3 votes
1 answer
419 views

Take this basic component using state: ...
user8758206's user avatar
3 votes
1 answer
157 views

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 ...
JimmyHu's user avatar
  • 7,575
1 vote
0 answers
70 views

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 ...
eccentricOrange's user avatar
1 vote
2 answers
134 views

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 ...
eccentricOrange's user avatar
2 votes
0 answers
91 views

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 ...
user avatar

1
2 3 4 5
21