Azure / Azure/ctest

CTEST_ASSERT_ARE_EQUAL doesn't work with array type

Open
#18 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
21
Forks
17
Avg merge
33m
Merged PRs (30d)
3

Description

Example:

```
typedef unsigned char my_type[32];

// … test code
ASSERT_ARE_EQUAL(my_type, a, b);
```

Fails to compile in `CTEST_ASSERT_ARE_EQUAL` because the code tries to cast/assign an array type:

```
#define CTEST_ASSERT_ARE_EQUAL(type, A, B, ...) \
do { \
const type A_value = (const type)(A); \
const type B_value = (const type)(B); \
```

> error C2067: cast to array type is illegal

Instead, this *does* work:

```
typedef unsigned char my_type[32];
typedef my_type* my_type_ptr;

// … test code
ASSERT_ARE_EQUAL(my_type_ptr, &a, &b);
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.