Skip to content

Commit

Permalink
Ensure majority swap is correct with strings too
Browse files Browse the repository at this point in the history
Signed-off-by: Alexis Jeandet <alexis.jeandet@member.fsf.org>
  • Loading branch information
jeandet committed Jun 22, 2024
1 parent 6ee9838 commit b5f2867
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 1 deletion.
9 changes: 9 additions & 0 deletions tests/python_loading/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,15 @@
'type': pycdfpp.DataType.CDF_CHAR,
'values': np.char.encode([['value[00]', 'value[01]'], ['value[10]', 'value[11]']]),
'attributes': {}
},
'var4d_string': {
'shape': (1, 3, 2, 2, 10),
'type': pycdfpp.DataType.CDF_CHAR,
'values': np.char.encode([
[['value[000]','value[001]'],['value[010]','value[011]']],
[['value[100]','value[101]'],['value[110]','value[111]']],
[['value[200]','value[201]'],['value[210]','value[211]']]]),
'attributes': {}
}
}

Expand Down
Binary file modified tests/resources/a_cdf.cdf
Binary file not shown.
Binary file modified tests/resources/a_cdf_with_compressed_vars.cdf
Binary file not shown.
Binary file modified tests/resources/a_col_major_cdf.cdf
Binary file not shown.
Binary file modified tests/resources/a_compressed_cdf.cdf
Binary file not shown.
Binary file modified tests/resources/a_rle_compressed_cdf.cdf
Binary file not shown.
5 changes: 5 additions & 0 deletions tests/resources/make_cdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ def add_varaibles(cd, compress=False):
cd.new('var_string', data='This is a string', recVary=False)
cd.new('var2d_string', data=['This is a string 1','This is a string 2'], recVary=False)
cd.new('var3d_string', data=[['value[00]','value[01]'],['value[10]','value[11]']], recVary=False)
cd.new('var4d_string', data=[
[['value[000]','value[001]'],['value[010]','value[011]']],
[['value[100]','value[101]'],['value[110]','value[111]']],
[['value[200]','value[201]'],['value[210]','value[211]']]
], recVary=False)
cd.new('empty_var_recvary_string', type=pycdf.const.CDF_CHAR, recVary=True,n_elements=16)
cd.new('var_recvary_string',data=['001','002','003'], type=pycdf.const.CDF_CHAR, recVary=True,n_elements=3)
cd.new('epoch16', type=pycdf.const.CDF_EPOCH16, data=make_time_list(100))
Expand Down
2 changes: 1 addition & 1 deletion tests/simple_open/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ std::size_t filesize(std::fstream& file)


#define CHECK_VARIABLES(cd) \
REQUIRE(std::size(cd.variables) == 17); \
REQUIRE(std::size(cd.variables) == 18); \
REQUIRE(has_variable(cd, "var")); \
REQUIRE(compare_shape(cd.variables["var"], { 101 })); \
REQUIRE(check_variable( \
Expand Down

0 comments on commit b5f2867

Please sign in to comment.