The Bodhisatta was once a tree fairy and he saw the following happen near his dwelling. A fruit and vegetable seller had a beautiful daughter who acted virtuous in every way, but because she laughed a lot, he had doubts about her chastity. When a family asked for her to be married to their son the seller needed to know for sure whether she was truly good or not, because if she wasn’t he would be shamed. So he had his daughter come with him to gather herbs in the forest and while there he took her hand and asked her to have sex with him. She burst into tears and cursed her father. Then he explained himself and asked if she was a virgin. She said she was, and so he took her home, made a feast, and gave her away in marriage.
In the Lifetime of the Buddha
A lay follower of the Buddha who made a living as a fruit and vegetable seller took his daughter to the forest and propositioned her to determine if she was a virgin or not, and when he found that she was he gave her away in marriage. The Buddha told him this story so he knew that in earlier births he and his daughter had done the same test in the same manner for the same reason with the same result.