I've written some RAM tests before that have roused up some errors. Here's what I did:
Data bus integrity - are all the data lines connected? First, write all 0's to an address and read it back, ensure it's all 0's. Second, write all 1's to a memory location, read it back and ensure all 1's. This will quickly tell you if one of your lines is simply not connected. But that's not the whole story. It could be that several lines are bridged to each other or to VCC or ground. That why you do the next test as well.
Walking 1's/walking 0's test - The idea is to exercise each bit in your data line and only that bit. So if you have an 8-bit wide data bus then you start by writing 00000001 to a memory address, then reading it back and verifying you get the same value, then 00000010, then 00000100 and so on, writing a 1 on each line individually until you've tested each line. Then you do a walking 0's test: first write 11111110 and confirm, then 11111101 and confirm, etc.
This test can be done just once - you don't need to repeat it for every memory address you have - it only ensure the data bus is properly connected.
Address line integrity - To test the address bus you have to write a unique value into each memory address you can access, then go back and verify that the data in each address is correct. If your address lines aren't correct you'll see incorrect data retrieved from memory. For instance, let's say that I have 8 memory addressing lines and the first one is shorted to VCC. If I try to write to location 00000000 it will actually write to 00000001 because of the short. Then I'll try to write to 0x01 to 00000001 and it will work. However, when it comes time to check the data in each address if I try to access location 00000000 I will actually access location 00000001 because of the short, and retrieve a value of 0x01 instead of 0x00 and immediately catch the error.
It's overkill but it has detected some insidious errors that would have tripped us up to a great degree.
What the above tests will NOT do is tell you if any of your address lines are messagese tests will NOT do is tell you whether