So, when you go to use the Marauder's Map, you have to say 'I solemnly swear that I'm up to no good'. My question is then, does the map know whether this is true and, if so, what happens if you not are up to no good?
The map appears to still work every time the user is up to objective "good". The phrase "I solemnly swear that I'm up to no good" seems to just be the password.
“If you haven’t been helping him,” he said, with a furious glance at Black, “how did you know he was here?”
“The map,” said Lupin. “The Marauder’s Map. I was in my office examining it —”
“You know how to work it?” Harry said suspiciously.
“Of course I know how to work it,” said Lupin, waving his hand impatiently. “I helped write it. I’m Moony — that was my friends’ nickname for me at school.”
Here Lupin is using the map to police the grounds, and watch out for Black. This is probably the best used instance in the whole book.
Another example is Harry watching out for Malfoy in book 6, and Harry watching Ginny's dot in book 7.
At once, the Marauder’s Map appeared on the parchment’s surface. Here was a detailed plan of every one of the castle’s floors and, moving around it, the tiny, labeled black dots that signified each of the castle’s occupants.
“Help me find Malfoy,” said Harry urgently.
He laid the map upon his bed, and he and Ron leaned over it, searching.
“There!” said Ron, after a minute or so. “He’s in the Slytherin common room, look ... with Parkinson and Zabini and Crabbe and Goyle ...”
He was on the point of taking out the Marauder’s Map, so as to watch Ginny’s dot for a while, before he remembered that it was the Christmas holidays and that she would be back at the Burrow.
The map was created by James Potter (Prongs), Sirius Black (Padfoot), Remus Lupin (Moony) and Peter Pettigrew (Wormtail) when they were students at Hogwarts. They were known to be the most mischievous students in Hogwarts (at least until the Weasley twins came along). As students, their primary objective was to perform some mischief or the other at school. Hence, to make the map disappear, one has to say "Mischief managed".
There is no way for the map to know whether or not the user has performed any mischief, since mischief is kinda subjective, just as "being up to no good" is. The creators of the map just thought it would be funny to use those terms as passcodes to reveal and hide the map.