<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>pointer length conflict in Unity tests with native_sim</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/114496/pointer-length-conflict-in-unity-tests-with-native_sim</link><description>Hello, 
 In my efforts to upgrade my project from NCS 2.3.0 (with Zephyr 3.2.99) to NCS 2.6.1 (with Zephyr 3.5.99), I&amp;#39;m running into various build issues with Unity unit tests. 
 I&amp;#39;m running the unit tests with the native_sim board. I&amp;#39;m running this in</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 04 Oct 2024 00:11:23 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/114496/pointer-length-conflict-in-unity-tests-with-native_sim" /><item><title>RE: pointer length conflict in Unity tests with native_sim</title><link>https://devzone.nordicsemi.com/thread/504910?ContentTypeID=1</link><pubDate>Fri, 04 Oct 2024 00:11:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6b906ca1-58a8-4af2-8795-4fd6105a04c7</guid><dc:creator>Yaron Shragai</dc:creator><description>&lt;p&gt;Your reply led me find &lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;TEST_ASSERT_EQUAL_PTR()&lt;/span&gt;, which is what is most appropriate in this case.&lt;/p&gt;
&lt;p&gt;Thanks.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: pointer length conflict in Unity tests with native_sim</title><link>https://devzone.nordicsemi.com/thread/504582?ContentTypeID=1</link><pubDate>Tue, 01 Oct 2024 17:46:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b9c6db69-46a0-480d-9100-93f924bee2bd</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi!&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
[quote user=""]This is because &lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;TEST_ASSERT_EQUAL()&lt;/span&gt; casts both values to &lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;UNITY_INT&lt;/span&gt;.&lt;br /&gt;And, I&amp;#39;ve ascertained that &lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;UNITY_INT&lt;/span&gt; in my environment resolves to 64 bits, while the pointers are 32 bits.[/quote]
&lt;p&gt;&lt;span&gt;Sorry for the delay.&amp;nbsp;&lt;/span&gt;So if there is a mismatch here, maybe you could try to use&amp;nbsp;TEST_ASSERT_EQUAL_INT32() or&amp;nbsp;TEST_ASSERT_EQUAL_UINT32(), instead of&amp;nbsp;TEST_ASSERT_EQUAL() ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: pointer length conflict in Unity tests with native_sim</title><link>https://devzone.nordicsemi.com/thread/503452?ContentTypeID=1</link><pubDate>Mon, 23 Sep 2024 16:51:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3f5a36bd-1828-4599-b18c-6d9bdef3f8a6</guid><dc:creator>Yaron Shragai</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Still waiting on a response on this.&lt;/p&gt;
&lt;p&gt;It has been almost 3 weeks.&lt;/p&gt;
&lt;p&gt;Thanks!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: pointer length conflict in Unity tests with native_sim</title><link>https://devzone.nordicsemi.com/thread/502348?ContentTypeID=1</link><pubDate>Thu, 12 Sep 2024 14:50:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:951ce0ab-45d0-45fa-856a-ae40d3bef941</guid><dc:creator>Yaron Shragai</dc:creator><description>&lt;p&gt;Hi, I&amp;#39;m wondering if there have been any further thoughts on this.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: pointer length conflict in Unity tests with native_sim</title><link>https://devzone.nordicsemi.com/thread/501404?ContentTypeID=1</link><pubDate>Thu, 05 Sep 2024 14:54:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:915587f3-dce5-4740-90c4-12d816366bac</guid><dc:creator>Yaron Shragai</dc:creator><description>&lt;p&gt;A clarification: The definition/assignment of &lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;my_pointer&lt;/span&gt; is&amp;nbsp;inside one of my test functions. In other words, it&amp;#39;s kind of like:&lt;/p&gt;
&lt;pre&gt;void test_my_feature(void) {&lt;br /&gt;&lt;br /&gt;    struct device const * const my_pointer = function_that_I_want_to_test(some_value);&lt;br /&gt;&lt;br /&gt;    TEST_ASSERT_EQUAL(DEVICE_DT_GET(DT_NODELABEL(some_node)), my_pointer);&lt;br /&gt;&lt;br /&gt;}&lt;/pre&gt;
&lt;p&gt;So, the &lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;static&lt;/span&gt; keyword is not of use here.&lt;/p&gt;
&lt;p&gt;But I did try changing the line to your suggestion, for the fun of it. It still gave the &amp;quot;cast from pointer to integer of different size&amp;quot; error (not surprisingly, I think - it doesn&amp;#39;t address the width difference), and&amp;nbsp;furthermore, gave &amp;quot;initializer element is not constant&amp;quot; due to the &lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;static&lt;/span&gt;.&lt;/p&gt;
&lt;p&gt;Also for the fun of it, I tried changing to:&lt;/p&gt;
&lt;pre&gt;struct device const * my_pointer =&lt;span&gt;&amp;nbsp;&lt;/span&gt;function_that_I_want_to_test(some_value);&lt;/pre&gt;
&lt;p&gt;(i.e., dropped the second &amp;quot;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;const&lt;/span&gt;&amp;quot; - i.e., just a pointer to a const, not a const pointer to a const). Still got &amp;quot;cast from pointer to integer of different size&amp;quot;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: pointer length conflict in Unity tests with native_sim</title><link>https://devzone.nordicsemi.com/thread/501369?ContentTypeID=1</link><pubDate>Thu, 05 Sep 2024 12:40:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e390958c-2c50-4e64-bb91-95cee43e4f15</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi!&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
[quote user=""]struct device const * const my_pointer = some_value;[/quote]
&lt;p&gt;&lt;span&gt;Could you try this instead?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;static&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;const&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;struct&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;device&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;*&lt;span&gt;my_pointer&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>