Skip to main content

Utility designed for check combinations of multiple binary params

Project description

# Abstract

I needed an util that create good binary params combinations set to test that I didn't broke my product. To test just 15 options in straight way there was 2^15 variants (32768). Each service restart with changed config took ten seconds.

So I recalled a method mentioned by @backendsecret about half year ago, found a library AllPairs and built my util on top of it.

# Install:
```
pip install binary-pairs
```

# Usage:
```
binary-pairs <number of params>
```

# Examples
```
$ binary-pairs 3
0 0 0
1 1 0
1 0 1
0 1 1

$ binary-pairs 15
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1 1 1 1 1 1 1 1 1 1 1 1 1 1 0
1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
0 1 0 1 0 1 0 1 0 1 0 1 0 1 1
0 1 1 0 0 1 1 0 0 1 1 0 0 1 1
1 0 0 1 1 0 0 1 1 0 0 1 0 1 1
0 1 0 1 1 0 1 0 0 1 0 1 1 0 1
1 0 1 0 0 1 0 1 0 1 0 1 1 0 1
0 1 0 1 0 1 0 1 1 0 1 0 1 0 1

$ binary-pairs 30
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0
1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 1
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1
1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 0 1
0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1
1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 0 0 0 1 1 1
0 0 0 1 0 0 0 1 1 1 1 0 1 1 1 0 0 0 0 1 0 0 0 1 1 1 1 0 1 1
1 1 1 0 1 1 1 0 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 1 1 1 0 1 1
0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 1 1 1 0 1 1 1 0 1 1 1 0 1 1
```

# Howto, shell
```
#!/bin/bash

set -eu

while read opt1 opt2 opt3 opt4; do
echo -n "opt1=$opt1 opt2=$opt2 opt3=$opt3 opt4=$opt4 "
do_something $opt1 $opt2 $opt3 $opt4 && echo Success
done <<< "$(binary-pairs 4)"
```

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

binary-pairs-0.0.2.tar.gz (2.1 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page