Skip to content

Instantly share code, notes, and snippets.

View PsichiX's full-sized avatar
👨‍🔬
For the Symmetry! [mental health vacation]

Patryk Budzyński PsichiX

👨‍🔬
For the Symmetry! [mental health vacation]
View GitHub Profile
@PsichiX
PsichiX / 0_test.rs
Last active August 12, 2024 23:34
NEAT - XOR
#[test]
fn test_neat_xor() {
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
enum Input {
A,
B,
Control,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
@PsichiX
PsichiX / 0_test_library.rs
Last active October 24, 2024 20:29
FFI support for Intuicio scripting platform
let registry = Registry::default().with_basic_types();
let mut context = Context::new(10240, 10240);
let mut lib = FfiLibrary::new("../../target/debug/ffi").unwrap();
let ffi_add = lib
.function(function_signature!(&registry => fn add(a: i32, b: i32) -> (result: i32)))
.unwrap();
let ffi_ensure = lib
.function(function_signature!(&registry => fn ensure_42(v: i32) -> ()))
.unwrap();
context.stack().push(2i32);
@PsichiX
PsichiX / tests.rs
Last active November 25, 2024 23:03
Transaction interface for editable data
#[test]
fn test_editable() {
let mut editable = Editable::new(0usize);
assert_eq!(editable.done_count(), 0);
assert_eq!(editable.undone_count(), 0);
editable
.edit_snapshot("set 42", |data| {
*data = 42;
Ok(())
@PsichiX
PsichiX / lib.rs
Created February 6, 2025 10:14
Graph Queries
use crate::{
graph::Graph,
query::{Is, Node, Query, Related, Traverse},
AnyIndex,
};
struct Child;
struct Parent;
struct Effect;
struct Attribute;