@@ -527,6 +527,47 @@ TEST_CLASS(MemoryWatchListViewModel_Tests)
527527 Assert::AreEqual (4U , pItem.GetChanges ());
528528 }
529529
530+ TEST_METHOD (TestAddItemASCIIIndirect)
531+ {
532+ MemoryWatchListViewModelHarness watchList;
533+
534+ std::array<uint8_t , 64 > memory = {};
535+ memory.at (0 ) = 8 ;
536+ memory.at (8 ) = ' H' ;
537+ memory.at (9 ) = ' i' ;
538+ memory.at (12 ) = ' B' ;
539+ memory.at (13 ) = ' y' ;
540+ memory.at (14 ) = ' e' ;
541+ watchList.mockEmulatorContext .MockMemory (memory);
542+
543+ watchList.AddItem (" I:0x 0000_M:0xX0000" , ra::data::Memory::Format::Hex);
544+
545+ Assert::AreEqual ({ 1U }, watchList.Items ().Count ());
546+ auto & pItem = *watchList.Items ().GetItemAt (0 );
547+ pItem.SetSize (ra::data::Memory::Size::Text);
548+
549+ // text @ word(0) | word(0) = 0x0008
550+ Assert::AreEqual (std::wstring (L" " ), pItem.GetRealNote ());
551+ Assert::AreEqual (8U , pItem.GetAddress ());
552+ Assert::IsTrue (pItem.IsIndirectAddress ());
553+ Assert::AreEqual (ra::data::Memory::Size::Text, pItem.GetSize ());
554+ Assert::AreEqual (std::wstring (L" Hi" ), pItem.GetCurrentValue ());
555+ Assert::AreEqual (std::wstring (L" 00000000" ), pItem.GetPreviousValue ()); // from before size was changed to text
556+ Assert::AreEqual (0U , pItem.GetChanges ());
557+
558+ memory.at (0 ) = 12 ;
559+ watchList.DoFrame ();
560+ Assert::AreEqual (std::wstring (L" Bye" ), pItem.GetCurrentValue ());
561+ Assert::AreEqual (std::wstring (L" Hi" ), pItem.GetPreviousValue ());
562+ Assert::AreEqual (1U , pItem.GetChanges ());
563+
564+ memory.at (1 ) = 1 ; // word(0) = 0x010C | out of range
565+ watchList.DoFrame ();
566+ Assert::AreEqual (std::wstring (L" " ), pItem.GetCurrentValue ());
567+ Assert::AreEqual (std::wstring (L" Bye" ), pItem.GetPreviousValue ());
568+ Assert::AreEqual (2U , pItem.GetChanges ());
569+ }
570+
530571 TEST_METHOD (TestSetCurrentValue)
531572 {
532573 MemoryWatchListViewModelHarness watchList;
0 commit comments