{"id":42364955,"url":"https://github.com/chriso345/lemma","last_synced_at":"2026-01-27T18:03:40.483Z","repository":{"id":322953225,"uuid":"1031224013","full_name":"ChrisO345/lemma","owner":"ChrisO345","description":"Generated Test Data for Go","archived":false,"fork":false,"pushed_at":"2025-11-07T07:15:48.000Z","size":12,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-11-07T09:13:49.418Z","etag":null,"topics":["generation","golang","test-data","testing"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ChrisO345.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-08-03T09:34:42.000Z","updated_at":"2025-11-07T07:15:52.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/ChrisO345/lemma","commit_stats":null,"previous_names":["chriso345/lemma"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/ChrisO345/lemma","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChrisO345%2Flemma","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChrisO345%2Flemma/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChrisO345%2Flemma/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChrisO345%2Flemma/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ChrisO345","download_url":"https://codeload.github.com/ChrisO345/lemma/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChrisO345%2Flemma/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28817795,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-27T18:01:38.485Z","status":"ssl_error","status_checked_at":"2026-01-27T18:01:27.499Z","response_time":168,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["generation","golang","test-data","testing"],"created_at":"2026-01-27T18:02:30.049Z","updated_at":"2026-01-27T18:03:40.468Z","avatar_url":"https://github.com/ChrisO345.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# lemma\n\n`lemma` is a simple Go package for generating dynamic test data for unit tests, inspired by property-based testing libraries like Hypothesis.\n\n---\n\n## Features\n\n- **Randomized Data Generation** - Generate integers, floats, and custom command-based test data.\n- **Edge Case Coverage** - Includes extreme values for numeric types to help uncover edge case bugs.\n- **Custom Lemmas** - Users can define their own generators for complex types.\n- **Command Integration** - Dynamically generate arguments and execute commands for integration testing.\n\n---\n\n## Installation\n\n`lemma` is available on GitHub and can be installed using Go modules:\n\n```bash\ngo get github.com/chriso345/lemma\n````\n\n---\n\n## Usage\n\n### Basic Usage\n\nImport `lemma` and generate simple test data:\n\n```go\nimport (\n  \"testing\"\n\n  \"github.com/chriso345/lemma\"\n)\n\nfunc TestIntegers(t *testing.T) {\n  lemma.Test(t, lemma.Int, func(x any) bool {\n    n := x.(int)\n    return n*2%2 == 0\n  })\n}\n```\n\n### Command-Based Lemmas\n\nGenerate test commands dynamically, optionally using placeholders like `%d` for integers or `%f` for floats:\n\n```go\ncmd := lemma.Command(\"echo\", \"%d3\", \"%f2\", \"literal\")\nlemma.Test(t, cmd, func(result any) bool {\n  value := result.(lemma.CommandResult)\n  args := value.Args\n  res := value.Result\n  // args is [\"echo\", \"5\", \"3\", \"7\", \"1.234\", \"0.987\", \"literal\"] (example)\n  return len(args) \u003e 0\n})\n```\n\n### Custom Lemmas\n\nDefine your own generator for custom types:\n\n```go\ntype CustomLemma struct {\n\trandomCount int64\n\tseed        int64\n}\n\nfunc (c *CustomLemma) New(randomCount int64, seed int64) {\n\tc.randomCount = randomCount\n\tc.seed = seed\n}\n\nfunc (c *CustomLemma) Generate() []any {\n\tanys := make([]any, c.randomCount)\n\n\tfor i := int64(0); i \u003c c.randomCount; i++ {\n\t\tanys[i] = fmt.Sprintf(\"custom_value_%d\", i)\n\t}\n\treturn anys\n}\n\nfunc TestCustomLemma(t *testing.T) {\n\tcustomCorollary := corollary.DefaultCorollary()\n\tcustomCorollary.Custom = \u0026CustomLemma{}\n\n  lemma.Test(mt, lemma.Custom, func(x any) bool {\n    value := x.(string)\n    return value == \"\"\n  }, *customCorollary)\n}\n```\n\n---\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchriso345%2Flemma","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchriso345%2Flemma","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchriso345%2Flemma/lists"}