{"id":13783087,"url":"https://github.com/PaulioRandall/volley","last_synced_at":"2025-05-11T17:30:58.398Z","repository":{"id":129496413,"uuid":"168052543","full_name":"PaulioRandall/volley","owner":"PaulioRandall","description":"(Discontinued) Small embedded Lua interpreter designed for testing JSON based web services and with a binary comfortable fitting inside repositories","archived":true,"fork":false,"pushed_at":"2020-01-23T14:51:15.000Z","size":100,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2024-04-24T16:41:29.720Z","etag":null,"topics":["api","c","embedded","http","json","learning","learning-by-doing","lua","makefile","scripting","small-tools","testing"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":false,"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/PaulioRandall.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}},"created_at":"2019-01-28T23:04:41.000Z","updated_at":"2023-01-28T16:01:14.000Z","dependencies_parsed_at":"2023-06-11T12:00:30.036Z","dependency_job_id":null,"html_url":"https://github.com/PaulioRandall/volley","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PaulioRandall%2Fvolley","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PaulioRandall%2Fvolley/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PaulioRandall%2Fvolley/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PaulioRandall%2Fvolley/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PaulioRandall","download_url":"https://codeload.github.com/PaulioRandall/volley/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":213838158,"owners_count":15645784,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["api","c","embedded","http","json","learning","learning-by-doing","lua","makefile","scripting","small-tools","testing"],"created_at":"2024-08-03T18:01:52.734Z","updated_at":"2024-08-03T18:11:19.921Z","avatar_url":"https://github.com/PaulioRandall.png","language":"C","funding_links":[],"categories":["C"],"sub_categories":[],"readme":"\n# (Discontinued) Volley\n\n\\*\\*\\***This project is no longer active and has been archived.**\\*\\*\\*\n\nVolley is a small Lua embedded executable designed to do service tests for JSON based APIs and placed inside code repositories with the source code it serves.\n\n- End to end testing\n- Contract driven development\n- Test driven development\n\nThis is both a learning project (C, Lua and makefiles) and experimental product. Lean development principles and continuous improvement are core to the project.\n\n## External libraries\n\nParson (https://github.com/kgabis/parson) is being used for JSON serialisation.\n\n## Prerequisites\n\n\u003e Written and tested on Ubuntu Linux\n\nThe Lua library (`liblua.a`) is required to build the application. This can be installed via a package manager or the source code can be downloaded, compiled and `liblua.a` installed into `/usr/local/lib` (copy/paste).\n\n## Compile \u0026 Test\n\nCompile and test:\n\n```\ncd tests\n./test.sh\n```\n\n## Compile \u0026 Run\n\nCompile and run:\n\n```\ncd src\nmake\n./bigben ../scripts/test.lua\n```\n\nBuild:\n\n```\n$ cd src\n$ make\n$ make clean\n```\n\nRun... path to a Lua script must be provided as the first argument:\n\n```\n$ ./bigben ../scripts/test.lua\n```\n\n#### Make\n\nTask name | Action\n:---: | :---\n`make` | Same as `bigben`\n`make bigben` | Builds the application\n`make clean` | Removes all object files\n\n## Volley Functions\n\nExtra Lua functions, written in C, are available to aid in testing\n\nName | Description\n:---: | :---\n`ben_tabulate(string)` | Parses a JSON string into a Lua table\n`ben_stringify(table)` | Serialises a Lua table representing JSON into a JSON string\n`ben_is_array(table)` | Returns true if the supplied JSON table is a JSON array\n`ben_is_object(table)` | Returns true if the supplied JSON table is a JSON object\n\n#### De-serialise JSON string into a table\n\n`ben_tabulate(string)` parses a JSON string into a Lua table\n\n- Fails if the input string is not supplied\n- Fails if the input string is nil\n- Fails if the input string is not parsable JSON\n\n```lua\njson_str = [[\n{\n  \"bool\": true,\n  \"number\": 3.14,\n  \"string\": \"Lua\",\n  \"array\": [\n  \"item 1\",\n  \"item 2\"\n  ],\n  \"object\": {\n    \"a\": false,\n    \"b\": 9.4,\n    \"c\": \"C\",\n  }\n}\n]]\n\njson_table = ben_tabulate(json_str)\npi = json_table[number]\n```\n\n#### Stringify a JSON table\n\n`ben_stringify(table)` takes a Lua table representing a JSON structure and serialises it into a string\n\n- Fails if the input table is not supplied\n- Fails if the input table is nil\n- Fails if the input table is not, in fact, a table\n- If the input table does not represent a JSON table the behaviour is undefined\n\n```lua\njson_table = wildJsonTableAppeared()\n\njson_str = ben_stringify(json_table)\nprint(json_str)\n```\n\n#### Is a JSON table an array?\n\n`ben_is_array(table)` takes a Lua table representing a JSON structure and returns true if it's a JSON array\n\n- Fails if the input table is not supplied\n- Fails if the input table is nil\n- Fails if the input table is not, in fact, a table\n- If the input table does not represent a JSON table the behaviour is undefined\n\n```lua\njson_table = wildJsonTableAppeared()\n\nis_array = ben_is_array(json_table)\nprint(\"Is an array?... \" .. tostring(is_array))\n```\n\n#### Is a JSON table an object?\n\n`ben_is_object(table)` takes a Lua table representing a JSON structure and returns true if it's a JSON object\n\n- Fails if the input table is not supplied\n- Fails if the input table is nil\n- Fails if the input table is not, in fact, a table\n- If the input table does not represent a JSON table the behaviour is undefined\n\n```lua\njson_table = wildJsonTableAppeared()\n\nis_object = ben_is_object(json_table)\nprint(\"Is an object?... \" .. tostring(is_object))\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FPaulioRandall%2Fvolley","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FPaulioRandall%2Fvolley","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FPaulioRandall%2Fvolley/lists"}