move example to samples/systems

This commit is contained in:
BlackMATov
2025-08-19 05:59:41 +07:00
parent 9b796b2a8d
commit 91edfa9da9
6 changed files with 32 additions and 9 deletions

5
.luacov Normal file
View File

@@ -0,0 +1,5 @@
modules = {
['evolved'] = 'evolved.lua'
}
reporter = 'html'
reportfile = 'luacov.report.html'

View File

@@ -96,7 +96,7 @@ luarocks install evolved.lua
## Quick Start
To get started with `evolved.lua`, read the [Overview](#overview) section to understand the basic concepts and how to use the library. After that, check the [Example](develop/example.lua), which demonstrates complex usage of the library. Finally, refer to the [Cheat Sheet](#cheat-sheet) for a quick reference of all the functions and classes provided by the library.
To get started with `evolved.lua`, read the [Overview](#overview) section to understand the basic concepts and how to use the library. After that, check the [Samples](develop/samples), which demonstrate complex usage of the library. Finally, refer to the [Cheat Sheet](#cheat-sheet) for a quick reference of all the functions and classes provided by the library.
## Overview

View File

@@ -1,13 +1,13 @@
require 'develop.example'
require 'develop.untests'
require 'develop.samples.relations'
require 'develop.samples.systems'
require 'develop.testing.name_tests'
require 'develop.testing.pairs_tests'
require 'develop.testing.requires_fragment_tests'
require 'develop.testing.system_as_query_tests'
require 'develop.untests'
require 'develop.unbench'
require 'develop.usbench'

View File

@@ -5,17 +5,32 @@ local evo = require 'evolved'
evo.debug_mode(true)
local fragments = {
planet = evo.builder():name('planet'):tag():spawn(),
spaceship = evo.builder():name('spaceship'):tag():spawn(),
planet = evo.builder()
:name('planet')
:tag()
:spawn(),
spaceship = evo.builder()
:name('spaceship')
:tag()
:spawn(),
}
local relations = {
docked_to = evo.builder():name('docked_to'):tag():explicit():spawn(),
docked_to = evo.builder()
:name('docked_to')
:tag()
:spawn(),
}
local planets = {
mars = evo.builder():name('Mars'):set(fragments.planet):spawn(),
venus = evo.builder():name('Venus'):set(fragments.planet):spawn(),
mars = evo.builder()
:name('Mars')
:set(fragments.planet)
:spawn(),
venus = evo.builder()
:name('Venus')
:set(fragments.planet)
:spawn(),
}
local spaceships = {

View File

@@ -1441,3 +1441,6 @@ do
assert(evo.has(e, evo.pair(p, s)) and evo.get(e, evo.pair(p, s)) == nil)
end
end
-- TODO
-- builder:has/has_all/has_any should work with wildcards / remove too?