[WIP] Add r_set_cardinality()

This will add `r_set_cardinality` functionality with tests for each layer.
Can you expand this test to insert 1, 2, 3... 10 values and always check the cardinality? Maybe even from 1 up to 100 or 1000 elements ...