Macaulay2 Engine
Loading...
Searching...
No Matches
SubsetTest.cpp File Reference

gtest coverage for Subsets — the bijection between integers and k-subsets of {0..n-1}. More...

#include <cstdio>
#include <string>
#include <iostream>
#include <memory>
#include <gtest/gtest.h>
#include "comb.hpp"

Go to the source code of this file.

Functions

 TEST (Subsets, encode1)
 TEST (Subsets, encode2)
 TEST (Subsets, encode3)
 TEST (Subsets, encode4)
 TEST (Subsets, encode5)
bool sameSubset (const Subset &a, const Subset &b)
 TEST (Subsets, encode6)
 TEST (Subsets, concatenateSubsets)
 TEST (Subsets, outOfRange)
 TEST (Subsets, encodeBoundary)

Detailed Description

gtest coverage for Subsets — the bijection between integers and k-subsets of {0..n-1}.

Note
AI-generated documentation. Verify against the source before relying on it.

Hosts the TEST(Subsets, *) battery: the encode1 ... encode6 cases round-trip every k-subset through Subsets::decode(i, a) / Subsets::encode(a) for small (n, k) pairs (5 choose 2, 12 choose 6, ...) asserting that encode(decode(i)) == i for each index in the C(n, k) range; concatenateSubsets, outOfRange, and encodeBoundary cover the combining helper and the out-of-range guard rails. This encoding underpins the engine's free-resolution and Hilbert-function combinatorics, where each homological level indexes into a sparse range of subsets of variables.

Companion files PointArray.cpp (numerical clustering for NAG) and basics-test.cpp (the harness-itself liveness check) are covered by the same file-misc-tests markdown.

See also
comb.hpp
basics-test.cpp
PointArray.cpp
ARingTest.hpp

Definition in file SubsetTest.cpp.