Skip to content
osysharpPublic

About

Osysharp.Memory.Testing — an Osy# package. a deterministic, offline embedder for tests — a hashed bag of words — so a suite can assert what Memory.Search and [Searchable(Memory)] find without a model.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Osysharp.Memory

stated links between records, files remembered about a record, and the operator's statistics and prune — the memory verbs over the platform's vector store.

Examples

Taken from this package's own tests, which compile and run on every release.

using Osysharp.Memory;

[Test(Desk)]
[runas(Ada)]
void a_link_is_stated_and_withdrawn_from_either_end() {
  var q1 = Deal.Single(d => d.Title == "Q1 deal");
  var q3 = Deal.Single(d => d.Title == "Q3 deal");
  Assert.True(Supersede(q1, q3));
  UnitOfWork.Commit();
  // Which end was the source is storage: named the other way round, it is the same link.
  Assert.Equal(1, Unrelate(q3, q1));
  UnitOfWork.Commit();
  Assert.Equal(0, Unrelate(q1, q3));
}

From tests/link.test.osy.

using Osysharp.Memory;

[Test(Gate)]
[runas(Ops)]
void the_operator_may_read_what_memory_costs() {
  var usage = MemoryUsage(90);
  Assert.True(usage.Authored <= usage.Entries);
  Assert.True(usage.Reclaimable <= usage.Derived);
}

From tests/operator.test.osy.

using Osysharp.Memory;
using Osysharp.Storage;

[Test(Files)]
[runas(Ada)]
void a_file_never_remembered_has_nothing_to_forget() {
  var terms = new FileAsset { Name = "terms.txt", MimeType = "text/plain" };
  UnitOfWork.Commit();
  Assert.Equal(0, Drop(terms));
  // Forgetting is about recall, not storage: the file is still there.
  Assert.Equal(1, FileAsset.Count(f => f.Name == "terms.txt"));
}

From tests/remember.test.osy.

Learn more

Licence

MIT — see LICENSE.

About

Osysharp.Memory.Testing — an Osy# package. a deterministic, offline embedder for tests — a hashed bag of words — so a suite can assert what Memory.Search and [Searchable(Memory)] find without a model.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors