The Bodhisatta once became an Ajīvaka and practised all manner of austerities in order to test the efficiency of asceticism, enduring extremes of heat and cold. He realized his error as he lay dying, and was reborn in the deva world.
The story was told in reference to Sunakkhatta, who, having left the Order and joined Korakkhattiya, went about Vesāli, vilifying the Buddha and declaring that his doctrines did not lead to the destruction of suffering. When Sāriputta reported this to the Buddha, the Buddha declared that he had tested the efficacy of asceticism ninety kappas ago and had found it wanting. J.i.389-91.
The story is also referred to in the Cariyāpitaka iii.15 as the Mahālomahamsacariyā, where it exemplifies the practice of upekkhā. J.i.47.