Skip to content

Instantly share code, notes, and snippets.

@frogggias
Created March 16, 2023 22:49
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save frogggias/f7b685ebbb0239080727bdd8808a22a6 to your computer and use it in GitHub Desktop.
Save frogggias/f7b685ebbb0239080727bdd8808a22a6 to your computer and use it in GitHub Desktop.
GenZ fairy tale unit test by GPT4
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.Assertions.*
class FairyTaleTest {
@Test
fun `Once upon a time in a lit kingdom`() {
val kingdom = Kingdom("Vibeland")
val princess = InfluencerPrincess("Ava", followers = 100_000)
kingdom.addInhabitant(princess)
assertTrue(kingdom.inhabitants.contains(princess), "Influencer Princess should be in the kingdom")
assertTrue(princess.followers >= 100_000, "Influencer Princess should have at least 100k followers")
}
@Test
fun `An eco-friendly hero appears with his reusable straw`() {
val hero = EcoHero("Leo", reusableStraws = 50)
val dragon = Dragon("Drake")
hero.slay(dragon)
assertTrue(hero.dragonsSlain.contains(dragon), "Dragon should be slain by the eco-friendly hero")
assertTrue(hero.reusableStraws > 0, "EcoHero should have reusable straws")
}
@Test
fun `Influencer Princess and EcoHero started a podcast`() {
val princess = InfluencerPrincess("Ava", followers = 100_000)
val hero = EcoHero("Leo", reusableStraws = 50)
val podcast = Podcast("Saving the Kingdom and the Planet")
podcast.addHosts(princess, hero)
assertTrue(podcast.hosts.contains(princess), "Influencer Princess should be a podcast host")
assertTrue(podcast.hosts.contains(hero), "EcoHero should be a podcast host")
}
@Test
fun `And they lived happily ever after, going viral and fighting climate change`() {
val kingdom = Kingdom("Vibeland")
val princess = InfluencerPrincess("Ava", followers = 100_000)
val hero = EcoHero("Leo", reusableStraws = 50)
val royalWedding = kingdom.celebrateWedding(princess, hero)
assertEquals(princess, royalWedding.first, "Influencer Princess should be part of the royal wedding")
assertEquals(hero, royalWedding.second, "EcoHero should be part of the royal wedding")
val viralPosts = princess.createViralPosts(10)
assertTrue(viralPosts >= 10, "Influencer Princess should create at least 10 viral posts")
hero.plantTrees(1000)
assertTrue(hero.treesPlanted >= 1000, "EcoHero should plant at least 1000 trees")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment