|
4 | 4 |
|
5 | 5 | #include <cassert>
|
6 | 6 | #include <string>
|
7 |
| -#include "utils/test_setup.h" |
8 |
| -#include "utils/TestSetup.hpp" |
9 | 7 | #include "memory.h"
|
| 8 | +#include "../lib/client_int.h" |
10 | 9 | #include <vector>
|
| 10 | +#include "utils/test_setup.h" |
| 11 | +#include "utils/TestSetup.hpp" |
11 | 12 |
|
12 | 13 | typedef struct sf_string_attributes {
|
13 | 14 | SF_ATTRIBUTE type;
|
@@ -72,13 +73,15 @@ std::vector<sf_int_attributes> intAttributes = {
|
72 | 73 | { SF_CON_MAX_RETRY, 6 },
|
73 | 74 | { SF_CON_RETRY_TIMEOUT, 0 },
|
74 | 75 | { SF_CON_MAX_RETRY, 0 },
|
| 76 | + { SF_CON_MAX_VARCHAR_SIZE, SF_DEFAULT_MAX_OBJECT_SIZE }, |
| 77 | + { SF_CON_MAX_BINARY_SIZE, SF_DEFAULT_MAX_OBJECT_SIZE / 2 }, |
| 78 | + { SF_CON_MAX_VARIANT_SIZE, SF_DEFAULT_MAX_OBJECT_SIZE }, |
75 | 79 | };
|
76 | 80 |
|
77 | 81 | // unit test for snowflake_set_attribute and snowflake_get_attribute for all SF_ATTRIBUTE
|
78 | 82 | void test_set_get_all_attributes(void **unused)
|
79 | 83 | {
|
80 |
| - SF_CONNECT *sf = (SF_CONNECT *)SF_CALLOC(1, sizeof(SF_CONNECT)); |
81 |
| - memset(sf, 0, sizeof(SF_CONNECT)); |
| 84 | + SF_CONNECT *sf = snowflake_init(); |
82 | 85 |
|
83 | 86 | // Connection parameters that cannot be set by user
|
84 | 87 | sf->service_name = (char*)"test_service_name";
|
@@ -152,12 +155,17 @@ void test_set_get_all_attributes(void **unused)
|
152 | 155 | // set and get int attributes
|
153 | 156 | for (sf_int_attributes attr : intAttributes)
|
154 | 157 | {
|
155 |
| - status = snowflake_set_attribute(sf, attr.type, &attr.value); |
156 |
| - if (status != SF_STATUS_SUCCESS) |
| 158 | + if ((attr.type != SF_CON_MAX_VARCHAR_SIZE) && |
| 159 | + (attr.type != SF_CON_MAX_BINARY_SIZE) && |
| 160 | + (attr.type != SF_CON_MAX_VARIANT_SIZE)) |
157 | 161 | {
|
158 |
| - dump_error(&(sf->error)); |
| 162 | + status = snowflake_set_attribute(sf, attr.type, &attr.value); |
| 163 | + if (status != SF_STATUS_SUCCESS) |
| 164 | + { |
| 165 | + dump_error(&(sf->error)); |
| 166 | + } |
| 167 | + assert_int_equal(status, SF_STATUS_SUCCESS); |
159 | 168 | }
|
160 |
| - assert_int_equal(status, SF_STATUS_SUCCESS); |
161 | 169 |
|
162 | 170 | status = snowflake_get_attribute(sf, attr.type, &value);
|
163 | 171 | if (status != SF_STATUS_SUCCESS)
|
|
0 commit comments