Audio V4: Improve VTS error messages

This does not change the test logic or constraints.
It only improves the error messages.

Bug: 77307068
Test: atest VtsHalAudioV4_0TargetTest
Change-Id: I6c79ddd014d4ab8aba4f1d0b918888f83dfb63ad
Signed-off-by: Kevin Rocard <krocard@google.com>
diff --git a/audio/common/all-versions/test/utility/include/utility/PrettyPrintAudioTypes.h b/audio/common/all-versions/test/utility/include/utility/PrettyPrintAudioTypes.h
index 88a67e0..fd21820 100644
--- a/audio/common/all-versions/test/utility/include/utility/PrettyPrintAudioTypes.h
+++ b/audio/common/all-versions/test/utility/include/utility/PrettyPrintAudioTypes.h
@@ -48,6 +48,7 @@
 namespace AUDIO_HAL_VERSION {
 DEFINE_GTEST_PRINT_TO(AudioConfig)
 DEFINE_GTEST_PRINT_TO(AudioDevice)
+DEFINE_GTEST_PRINT_TO(AudioFormat)
 DEFINE_GTEST_PRINT_TO(AudioChannelMask)
 }  // namespace AUDIO_HAL_VERSION
 }  // namespace common
diff --git a/audio/core/4.0/vts/functional/AudioPrimaryHidlHalTest.cpp b/audio/core/4.0/vts/functional/AudioPrimaryHidlHalTest.cpp
index 9484ddd..5ce2cdc 100644
--- a/audio/core/4.0/vts/functional/AudioPrimaryHidlHalTest.cpp
+++ b/audio/core/4.0/vts/functional/AudioPrimaryHidlHalTest.cpp
@@ -727,11 +727,12 @@
     ASSERT_OK(ret);
 
     if (currentMustBeSupported) {
+        ASSERT_NE(0U, capabilities.size()) << name << " must not return an empty list";
         Property currentValue = extract((stream->*getter)());
-        EXPECT_NE(std::find(capabilities.begin(), capabilities.end(), currentValue),
-                  capabilities.end())
-            << "current " << name << " is not in the list of the supported ones "
-            << toString(capabilities);
+        EXPECT_TRUE(std::find(capabilities.begin(), capabilities.end(), currentValue) !=
+                    capabilities.end())
+            << "value returned by " << name << "() = " << testing::PrintToString(currentValue)
+            << " is not in the list of the supported ones " << toString(capabilities);
     }
 
     // Check that all declared supported values are indeed supported