Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/sas/readstat_sas7bdat_read.c
Original file line number Diff line number Diff line change
Expand Up @@ -1404,7 +1404,7 @@ static readstat_error_t sas7bdat_parse_all_pages_pass2(sas7bdat_ctx_t *ctx) {
}
goto cleanup;
}
if (ctx->parsed_row_count == ctx->row_limit)
if (ctx->row_limit > 0 && ctx->parsed_row_count == ctx->row_limit)
break;
}
cleanup:
Expand Down
28 changes: 28 additions & 0 deletions src/test/test_list.h
Original file line number Diff line number Diff line change
Expand Up @@ -674,6 +674,34 @@ static rt_test_group_t _test_groups[] = {
}
}
}
},

{
.label = "Empty SAS file with metadata spill-over beyond first page",
.test_formats = RT_FORMAT_SAS7BDAT,
.rows = 0,
.columns = {
{ .name = "one_of_many_long_column_names_1", .label = "Label for column 1", .format = "$CHAR8", .type = READSTAT_TYPE_STRING },
{ .name = "one_of_many_long_column_names_2", .label = "Label for column 2", .format = "$CHAR8", .type = READSTAT_TYPE_STRING },
{ .name = "one_of_many_long_column_names_3", .label = "Label for column 3", .format = "$CHAR8", .type = READSTAT_TYPE_STRING },
{ .name = "one_of_many_long_column_names_4", .label = "Label for column 4", .format = "$CHAR8", .type = READSTAT_TYPE_STRING },
{ .name = "one_of_many_long_column_names_5", .label = "Label for column 5", .format = "$CHAR8", .type = READSTAT_TYPE_STRING },
{ .name = "one_of_many_long_column_names_6", .label = "Label for column 6", .format = "$CHAR8", .type = READSTAT_TYPE_STRING },
{ .name = "one_of_many_long_column_names_7", .label = "Label for column 7", .format = "$CHAR8", .type = READSTAT_TYPE_STRING },
{ .name = "one_of_many_long_column_names_8", .label = "Label for column 8", .format = "$CHAR8", .type = READSTAT_TYPE_STRING },
{ .name = "one_of_many_long_column_names_9", .label = "Label for column 9", .format = "$CHAR8", .type = READSTAT_TYPE_STRING },
{ .name = "one_of_many_long_column_names_10", .label = "Label for column 10", .format = "$CHAR8", .type = READSTAT_TYPE_STRING },
{ .name = "one_of_many_long_column_names_11", .label = "Label for column 11", .format = "$CHAR8", .type = READSTAT_TYPE_STRING },
{ .name = "one_of_many_long_column_names_12", .label = "Label for column 12", .format = "$CHAR8", .type = READSTAT_TYPE_STRING },
{ .name = "one_of_many_long_column_names_13", .label = "Label for column 13", .format = "$CHAR8", .type = READSTAT_TYPE_STRING },
{ .name = "one_of_many_long_column_names_14", .label = "Label for column 14", .format = "$CHAR8", .type = READSTAT_TYPE_STRING },
{ .name = "one_of_many_long_column_names_15", .label = "Label for column 15", .format = "$CHAR8", .type = READSTAT_TYPE_STRING },
{ .name = "one_of_many_long_column_names_16", .label = "Label for column 16", .format = "$CHAR8", .type = READSTAT_TYPE_STRING },
{ .name = "one_of_many_long_column_names_17", .label = "Label for column 17", .format = "$CHAR8", .type = READSTAT_TYPE_STRING },
{ .name = "one_of_many_long_column_names_18", .label = "Label for column 18", .format = "$CHAR8", .type = READSTAT_TYPE_STRING },
{ .name = "one_of_many_long_column_names_19", .label = "Label for column 19", .format = "$CHAR8", .type = READSTAT_TYPE_STRING },
{ .name = "one_of_many_long_column_names_20", .label = "Label for column 20", .format = "$CHAR8", .type = READSTAT_TYPE_STRING }
}
}
}
},
Expand Down
5 changes: 5 additions & 0 deletions src/test/test_read.c
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,11 @@ static int handle_variable(int index, readstat_variable_t *variable,
readstat_variable_get_name(variable),
"Column names");

push_error_if_doubles_differ(rt_ctx,
readstat_type_class(column->type),
readstat_type_class(readstat_variable_get_type(variable)),
"Column type class");

push_error_if_strings_differ(rt_ctx, column->label,
readstat_variable_get_label(variable),
"Column labels");
Expand Down
2 changes: 1 addition & 1 deletion src/test/test_types.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <time.h>

#define RT_MAX_ROWS 10
#define RT_MAX_COLS 10
#define RT_MAX_COLS 20
#define RT_MAX_LABEL_SETS 2
#define RT_MAX_NOTES 2
#define RT_MAX_STRING_REFS 3
Expand Down
Loading