Skip to main content

cjc_runtime/
lib.rs

1//! CJC Runtime System
2//!
3//! This crate provides the core runtime infrastructure for the CJC deterministic
4//! numerical programming language. It is the largest crate in the workspace and
5//! underpins both the AST tree-walk interpreter (`cjc-eval`) and the MIR register
6//! machine executor (`cjc-mir-exec`).
7//!
8//! # Core Abstractions
9//!
10//! - [`Buffer<T>`] -- Deterministic memory allocation with COW (copy-on-write)
11//!   semantics. Cloning is O(1); mutation triggers a deep copy only when shared.
12//! - [`Tensor`] -- N-dimensional tensor backed by `Buffer<f64>`. Supports
13//!   element-wise arithmetic (SIMD-accelerated), matrix multiplication (tiled +
14//!   parallel), and numerically-stable reductions via [`BinnedAccumulatorF64`].
15//! - [`Value`] -- The universal tagged-union value type that flows through both
16//!   interpreters. Covers scalars, strings, tensors, closures, structs, enums,
17//!   and opaque type-erased objects (AD graphs, tidy views, quantum states).
18//! - [`RuntimeError`] -- Error type for all fallible runtime operations.
19//!
20//! # Determinism Guarantees
21//!
22//! - All floating-point reductions use Kahan or [`BinnedAccumulatorF64`] summation.
23//! - Ordered containers only ([`BTreeMap`]/[`BTreeSet`]) -- no `HashMap`/`HashSet`.
24//! - [`DetMap`] provides a deterministic hash map with [`murmurhash3`] hashing.
25//! - SIMD kernels avoid hardware FMA for bit-identical cross-platform results.
26//! - RNG is SplitMix64 with explicit seed threading (`cjc-repro`).
27//!
28//! # Memory Model
29//!
30//! - **NoGC tier:** [`Buffer<T>`], [`Tensor`], [`AlignedByteSlice`] -- zero GC
31//!   overhead, COW semantics.
32//! - **GC tier:** [`GcHeap`] / [`GcRef`] -- RC-backed object slab for class
33//!   instances.
34//! - **Arena tier:** [`FrameArena`] / [`ArenaStore`] -- bump allocation per
35//!   function frame for non-escaping temporaries.
36//!
37//! # Module Organization
38//!
39//! | Layer | Modules |
40//! |-------|---------|
41//! | Core types | [`value`], [`error`], [`buffer`], [`tensor`], [`tensor_dtype`] |
42//! | Builtins | [`builtins`] -- shared stateless dispatch for both executors |
43//! | Accumulation | [`accumulator`], [`dispatch`] |
44//! | Linear algebra | [`linalg`], [`sparse`], [`sparse_solvers`], [`sparse_eigen`] |
45//! | Statistics | [`stats`], [`distributions`], [`hypothesis`] |
46//! | Data | [`json`], [`datetime`], [`window`], [`timeseries`] |
47//! | ML / NN | [`ml`], [`fft`], [`clustering`], [`optimize`], [`interpolate`] |
48//! | Memory | [`gc`], [`object_slab`], [`frame_arena`], [`binned_alloc`], [`aligned_pool`] |
49//! | SIMD / Perf | [`tensor_simd`], [`tensor_tiled`], [`tensor_pool`] |
50//!
51//! [`BinnedAccumulatorF64`]: accumulator::BinnedAccumulatorF64
52//! [`BTreeMap`]: std::collections::BTreeMap
53//! [`BTreeSet`]: std::collections::BTreeSet
54
55// --- Core standalone modules ---
56
57/// BinnedAccumulator for order-invariant deterministic floating-point summation.
58pub mod accumulator;
59/// Complex number arithmetic with deterministic fixed-sequence operations.
60pub mod complex;
61/// Hybrid summation strategy dispatch (Kahan vs Binned) based on execution context.
62pub mod dispatch;
63/// IEEE 754 half-precision (f16) floating-point type.
64pub mod f16;
65/// Quantized tensor storage (4-bit, 8-bit) for memory-efficient inference.
66pub mod quantized;
67
68// --- Shared builtin dispatch (used by both cjc-eval and cjc-mir-exec) ---
69
70/// Stateless builtin function dispatch shared by both interpreters.
71///
72/// Every builtin registered here is callable from CJC source code. Functions
73/// that require interpreter state (print, GC, clock, RNG) stay in the
74/// individual executors.
75pub mod builtins;
76
77// --- Core data structures ---
78
79/// COW (copy-on-write) buffer -- the memory primitive under [`Tensor`].
80pub mod buffer;
81/// N-dimensional tensor with element-wise, reduction, linalg, and NN operations.
82pub mod tensor;
83/// Pre-allocated KV-cache scratchpad for zero-allocation transformer inference.
84pub mod scratchpad;
85/// 16-byte-aligned memory pool for SIMD-friendly byte buffers.
86pub mod aligned_pool;
87/// Internal bridge to compiled SIMD/tiled kernel functions.
88mod kernel_bridge;
89pub use kernel_bridge::kernel;
90/// Block-paged KV-cache (vLLM-style) for efficient autoregressive decoding.
91pub mod paged_kv;
92/// Size-class binned allocator for deterministic memory management.
93pub mod binned_alloc;
94/// Bump-arena per function frame for non-escaping temporaries.
95pub mod frame_arena;
96/// RC-backed object slab for class instances (replaces mark-sweep GC).
97pub mod object_slab;
98/// GC heap abstraction wrapping the RC-backed object slab.
99pub mod gc;
100/// Sparse matrix types: CSR and COO representations.
101pub mod sparse;
102/// Direct sparse solvers (LU factorization, triangular solve).
103pub mod sparse_solvers;
104/// L2-cache-friendly tiled matrix multiplication engine.
105pub mod tensor_tiled;
106/// AVX2 SIMD kernels for element-wise and unary tensor operations.
107pub mod tensor_simd;
108/// Tensor memory pool for reducing allocation pressure in hot loops.
109pub mod tensor_pool;
110/// Deterministic hash map using MurmurHash3 -- iteration order is fixed.
111pub mod det_map;
112/// Dense linear algebra: determinant, solve, eigenvalues, SVD, QR, LU.
113pub mod linalg;
114/// The universal [`Value`] tagged union and supporting types ([`Bf16`], [`FnValue`]).
115pub mod value;
116/// [`RuntimeError`] enum for all fallible runtime operations.
117pub mod error;
118/// Library registry for module-system symbol lookup.
119pub mod lib_registry;
120/// JSON parse/stringify builtins for CJC values.
121pub mod json;
122/// Pure-arithmetic datetime manipulation (epoch-based, no system clock).
123pub mod datetime;
124/// Rolling window aggregations (sum, mean, min, max).
125pub mod window;
126/// Descriptive and inferential statistics functions.
127pub mod stats;
128/// Probability distribution functions (CDF, PDF, PPF) for Normal, t, chi2, F.
129pub mod distributions;
130/// Hypothesis testing: t-test, chi-squared test, paired t-test.
131pub mod hypothesis;
132/// Machine learning loss functions and optimizer state types.
133pub mod ml;
134/// Fast Fourier Transform (radix-2 Cooley-Tukey).
135pub mod fft;
136/// Time-series stationarity tests (ADF).
137pub mod stationarity;
138/// ODE solver primitives (Euler, RK4 step functions).
139pub mod ode;
140/// Sparse eigenvalue solvers (Lanczos, Arnoldi).
141pub mod sparse_eigen;
142/// Interpolation primitives (linear, cubic spline).
143pub mod interpolate;
144/// Numerical optimization (gradient descent, L-BFGS, Nelder-Mead).
145pub mod optimize;
146/// Clustering algorithms (k-means, DBSCAN).
147pub mod clustering;
148/// Typed tensor storage: [`DType`] enum and byte-first [`TypedStorage`].
149pub mod tensor_dtype;
150/// Time-series analysis utilities (autocorrelation, differencing).
151pub mod timeseries;
152/// Numerical integration (trapezoidal, Simpson's rule).
153pub mod integrate;
154/// Numerical differentiation (finite differences).
155pub mod differentiate;
156
157// --- Re-exports for backward compatibility ---
158// All downstream crates that were doing `use cjc_runtime::Tensor` etc. continue to work.
159
160/// Re-export: COW buffer with deterministic copy-on-write semantics.
161pub use buffer::Buffer;
162/// Re-export: N-dimensional tensor -- the primary numerical type.
163pub use tensor::Tensor;
164/// Re-export: Pre-allocated KV-cache scratchpad.
165pub use scratchpad::Scratchpad;
166/// Re-export: 16-byte-aligned memory pool and byte slice.
167pub use aligned_pool::{AlignedPool, AlignedByteSlice};
168/// Re-export: Block-paged KV-cache types.
169pub use paged_kv::{KvBlock, PagedKvCache};
170/// Re-export: GC heap and reference types.
171pub use gc::{GcRef, GcHeap};
172/// Re-export: Size-class binned allocator.
173pub use binned_alloc::BinnedAllocator;
174/// Re-export: Bump-arena and arena store types.
175pub use frame_arena::{FrameArena, ArenaStore};
176/// Re-export: Object slab and slab reference types.
177pub use object_slab::{ObjectSlab, SlabRef};
178/// Re-export: Sparse matrix types (CSR and COO).
179pub use sparse::{SparseCsr, SparseCoo};
180/// Re-export: Tiled matrix multiplication engine.
181pub use tensor_tiled::TiledMatmul;
182/// Re-export: Deterministic map, MurmurHash3, and value hashing utilities.
183pub use det_map::{DetMap, murmurhash3, murmurhash3_finalize, value_hash, values_equal_static};
184/// Re-export: Universal value type and supporting types.
185pub use value::{Value, Bf16, FnValue};
186/// Re-export: Runtime error type.
187pub use error::RuntimeError;
188/// Re-export: Typed tensor storage types.
189pub use tensor_dtype::{DType, TypedStorage};
190
191// ---------------------------------------------------------------------------
192// Tests — remain here so they can use `super::*` to access all re-exports.
193// ---------------------------------------------------------------------------
194
195#[cfg(test)]
196mod tests {
197    use super::*;
198    use std::rc::Rc;
199    use cjc_repro::Rng;
200
201    // -- Buffer tests -------------------------------------------------------
202
203    #[test]
204    fn test_buffer_alloc_get_set() {
205        let mut buf = Buffer::alloc(5, 0.0f64);
206        assert_eq!(buf.len(), 5);
207        assert_eq!(buf.get(0), Some(0.0));
208        assert_eq!(buf.get(4), Some(0.0));
209        assert_eq!(buf.get(5), None);
210
211        buf.set(2, 42.0).unwrap();
212        assert_eq!(buf.get(2), Some(42.0));
213
214        assert!(buf.set(10, 1.0).is_err());
215    }
216
217    #[test]
218    fn test_buffer_from_vec() {
219        let buf = Buffer::from_vec(vec![1, 2, 3, 4, 5]);
220        assert_eq!(buf.len(), 5);
221        assert_eq!(buf.get(0), Some(1));
222        assert_eq!(buf.get(4), Some(5));
223        assert_eq!(buf.as_slice(), vec![1, 2, 3, 4, 5]);
224    }
225
226    #[test]
227    fn test_buffer_cow_behavior() {
228        let buf_a = Buffer::from_vec(vec![10, 20, 30]);
229        let mut buf_b = buf_a.clone();
230
231        assert_eq!(buf_a.refcount(), 2);
232        assert_eq!(buf_b.refcount(), 2);
233
234        buf_b.set(0, 99).unwrap();
235
236        assert_eq!(buf_a.refcount(), 1);
237        assert_eq!(buf_b.refcount(), 1);
238        assert_eq!(buf_a.get(0), Some(10));
239        assert_eq!(buf_b.get(0), Some(99));
240    }
241
242    #[test]
243    fn test_buffer_clone_buffer_forces_deep_copy() {
244        let buf_a = Buffer::from_vec(vec![1, 2, 3]);
245        let buf_b = buf_a.clone_buffer();
246
247        assert_eq!(buf_a.refcount(), 1);
248        assert_eq!(buf_b.refcount(), 1);
249        assert_eq!(buf_a.as_slice(), buf_b.as_slice());
250    }
251
252    // -- Tensor tests -------------------------------------------------------
253
254    #[test]
255    fn test_tensor_creation_and_indexing() {
256        let t = Tensor::zeros(&[2, 3]);
257        assert_eq!(t.shape(), &[2, 3]);
258        assert_eq!(t.ndim(), 2);
259        assert_eq!(t.len(), 6);
260        assert_eq!(t.get(&[0, 0]).unwrap(), 0.0);
261        assert_eq!(t.get(&[1, 2]).unwrap(), 0.0);
262
263        assert!(t.get(&[2, 0]).is_err());
264        assert!(t.get(&[0]).is_err());
265    }
266
267    #[test]
268    fn test_tensor_from_vec_and_set() {
269        let mut t = Tensor::from_vec(vec![1.0, 2.0, 3.0, 4.0, 5.0, 6.0], &[2, 3]).unwrap();
270        assert_eq!(t.get(&[0, 0]).unwrap(), 1.0);
271        assert_eq!(t.get(&[0, 2]).unwrap(), 3.0);
272        assert_eq!(t.get(&[1, 0]).unwrap(), 4.0);
273        assert_eq!(t.get(&[1, 2]).unwrap(), 6.0);
274
275        t.set(&[1, 1], 99.0).unwrap();
276        assert_eq!(t.get(&[1, 1]).unwrap(), 99.0);
277    }
278
279    #[test]
280    fn test_tensor_elementwise_ops() {
281        let a = Tensor::from_vec(vec![1.0, 2.0, 3.0, 4.0], &[2, 2]).unwrap();
282        let b = Tensor::from_vec(vec![5.0, 6.0, 7.0, 8.0], &[2, 2]).unwrap();
283
284        let sum = a.add(&b).unwrap();
285        assert_eq!(sum.to_vec(), vec![6.0, 8.0, 10.0, 12.0]);
286
287        let diff = a.sub(&b).unwrap();
288        assert_eq!(diff.to_vec(), vec![-4.0, -4.0, -4.0, -4.0]);
289
290        let prod = a.mul_elem(&b).unwrap();
291        assert_eq!(prod.to_vec(), vec![5.0, 12.0, 21.0, 32.0]);
292
293        let quot = b.div_elem(&a).unwrap();
294        assert_eq!(quot.to_vec(), vec![5.0, 3.0, 7.0 / 3.0, 2.0]);
295    }
296
297    #[test]
298    fn test_tensor_matmul_correctness() {
299        let a = Tensor::from_vec(vec![1.0, 2.0, 3.0, 4.0], &[2, 2]).unwrap();
300        let b = Tensor::from_vec(vec![5.0, 6.0, 7.0, 8.0], &[2, 2]).unwrap();
301
302        let c = a.matmul(&b).unwrap();
303        assert_eq!(c.shape(), &[2, 2]);
304        assert_eq!(c.get(&[0, 0]).unwrap(), 19.0);
305        assert_eq!(c.get(&[0, 1]).unwrap(), 22.0);
306        assert_eq!(c.get(&[1, 0]).unwrap(), 43.0);
307        assert_eq!(c.get(&[1, 1]).unwrap(), 50.0);
308    }
309
310    #[test]
311    fn test_tensor_matmul_nonsquare() {
312        let a = Tensor::from_vec(vec![1.0, 2.0, 3.0, 4.0, 5.0, 6.0], &[2, 3]).unwrap();
313        let b = Tensor::from_vec(vec![7.0, 8.0, 9.0, 10.0, 11.0, 12.0], &[3, 2]).unwrap();
314
315        let c = a.matmul(&b).unwrap();
316        assert_eq!(c.shape(), &[2, 2]);
317        assert_eq!(c.get(&[0, 0]).unwrap(), 58.0);
318        assert_eq!(c.get(&[0, 1]).unwrap(), 64.0);
319        assert_eq!(c.get(&[1, 0]).unwrap(), 139.0);
320        assert_eq!(c.get(&[1, 1]).unwrap(), 154.0);
321    }
322
323    #[test]
324    fn test_tensor_reshape_shares_buffer() {
325        let t = Tensor::from_vec(vec![1.0, 2.0, 3.0, 4.0, 5.0, 6.0], &[2, 3]).unwrap();
326        let r = t.reshape(&[3, 2]).unwrap();
327
328        assert_eq!(r.shape(), &[3, 2]);
329        assert_eq!(r.get(&[0, 0]).unwrap(), 1.0);
330        assert_eq!(r.get(&[2, 1]).unwrap(), 6.0);
331
332        assert_eq!(t.buffer.refcount(), 2);
333
334        assert!(t.reshape(&[4, 2]).is_err());
335    }
336
337    #[test]
338    fn test_tensor_sum_and_mean() {
339        let t = Tensor::from_vec(vec![1.0, 2.0, 3.0, 4.0], &[4]).unwrap();
340        assert!((t.sum() - 10.0).abs() < 1e-12);
341        assert!((t.mean() - 2.5).abs() < 1e-12);
342    }
343
344    // -- GC tests -----------------------------------------------------------
345
346    #[test]
347    fn test_gc_alloc_and_read() {
348        let mut heap = GcHeap::new(100);
349        let r1 = heap.alloc(42i64);
350        let r2 = heap.alloc("hello".to_string());
351
352        assert_eq!(heap.live_count(), 2);
353        assert_eq!(*heap.get::<i64>(r1).unwrap(), 42);
354        assert_eq!(heap.get::<String>(r2).unwrap().as_str(), "hello");
355
356        assert!(heap.get::<f64>(r1).is_none());
357    }
358
359    #[test]
360    fn test_gc_collect_is_noop_rc_backed() {
361        // In the RC-backed ObjectSlab, collect() is a no-op.
362        // All objects survive regardless of roots provided.
363        let mut heap = GcHeap::new(100);
364        let r1 = heap.alloc(1i64);
365        let r2 = heap.alloc(2i64);
366        let r3 = heap.alloc(3i64);
367
368        assert_eq!(heap.live_count(), 3);
369
370        // collect with partial roots — all objects survive (RC, not GC)
371        heap.collect(&[r1, r2]);
372
373        assert_eq!(heap.live_count(), 3, "RC keeps all objects alive");
374        assert_eq!(*heap.get::<i64>(r1).unwrap(), 1);
375        assert_eq!(*heap.get::<i64>(r2).unwrap(), 2);
376        assert_eq!(*heap.get::<i64>(r3).unwrap(), 3);
377    }
378
379    #[test]
380    fn test_gc_explicit_free_and_slot_reuse() {
381        // Slot reuse now requires explicit free() — no automatic GC collection.
382        let mut heap = GcHeap::new(100);
383        let r1 = heap.alloc(1i64);
384        let r2 = heap.alloc(2i64);
385        let r3 = heap.alloc(3i64);
386
387        // Explicitly free all three slots
388        heap.free(r1);
389        heap.free(r2);
390        heap.free(r3);
391        assert_eq!(heap.live_count(), 0);
392        assert_eq!(heap.free_list().len(), 3);
393
394        // New alloc reuses freed slot (LIFO)
395        let r4 = heap.alloc(99i64);
396        assert!(r4.index < 3, "should reuse a freed slot");
397        assert_eq!(*heap.get::<i64>(r4).unwrap(), 99);
398    }
399
400    // -- Stable summation test ----------------------------------------------
401
402    #[test]
403    fn test_stable_summation_via_tensor() {
404        let n = 100_000;
405        let data: Vec<f64> = (0..n).map(|_| 0.00001).collect();
406        let t = Tensor::from_vec(data, &[n]).unwrap();
407        let result = t.sum();
408        let expected = 0.00001 * n as f64;
409        assert!(
410            (result - expected).abs() < 1e-10,
411            "Kahan sum drift: expected {expected}, got {result}"
412        );
413    }
414
415    // -- Tensor randn determinism test --------------------------------------
416
417    #[test]
418    fn test_tensor_randn_deterministic() {
419        let mut rng1 = Rng::seeded(42);
420        let mut rng2 = Rng::seeded(42);
421
422        let t1 = Tensor::randn(&[3, 4], &mut rng1);
423        let t2 = Tensor::randn(&[3, 4], &mut rng2);
424
425        assert_eq!(t1.to_vec(), t2.to_vec());
426    }
427
428    // -- Value display test -------------------------------------------------
429
430    #[test]
431    fn test_value_display() {
432        assert_eq!(format!("{}", Value::Int(42)), "42");
433        assert_eq!(format!("{}", Value::Bool(true)), "true");
434        assert_eq!(format!("{}", Value::Void), "void");
435        assert_eq!(format!("{}", Value::String(Rc::new("hi".into()))), "hi");
436    }
437
438    #[test]
439    fn test_cow_string_clone_shares() {
440        let s = Value::String(Rc::new("hello".into()));
441        let s2 = s.clone();
442        if let (Value::String(a), Value::String(b)) = (&s, &s2) {
443            assert!(Rc::ptr_eq(a, b));
444        } else {
445            panic!("expected String values");
446        }
447    }
448
449    #[test]
450    fn test_cow_string_display() {
451        let s = Value::String(Rc::new("world".into()));
452        assert_eq!(format!("{}", s), "world");
453    }
454
455    // -- ByteSlice / StrView / U8 tests ------------------------------------
456
457    #[test]
458    fn test_byteslice_value_display_utf8() {
459        let bs = Value::ByteSlice(Rc::new(b"hello".to_vec()));
460        assert_eq!(format!("{}", bs), r#"b"hello""#);
461    }
462
463    #[test]
464    fn test_byteslice_value_display_hex() {
465        let bs = Value::ByteSlice(Rc::new(vec![0xff, 0x00, 0x41]));
466        assert_eq!(format!("{}", bs), r#"b"\xff\x00A""#);
467    }
468
469    #[test]
470    fn test_strview_value_display() {
471        let sv = Value::StrView(Rc::new(b"world".to_vec()));
472        assert_eq!(format!("{}", sv), "world");
473    }
474
475    #[test]
476    fn test_u8_value_display() {
477        assert_eq!(format!("{}", Value::U8(65)), "65");
478    }
479
480    #[test]
481    fn test_byteslice_hash_deterministic() {
482        let a = Value::ByteSlice(Rc::new(b"hello".to_vec()));
483        let b = Value::ByteSlice(Rc::new(b"hello".to_vec()));
484        assert_eq!(value_hash(&a), value_hash(&b));
485    }
486
487    #[test]
488    fn test_byteslice_hash_different_content() {
489        let a = Value::ByteSlice(Rc::new(b"hello".to_vec()));
490        let b = Value::ByteSlice(Rc::new(b"world".to_vec()));
491        assert_ne!(value_hash(&a), value_hash(&b));
492    }
493
494    #[test]
495    fn test_byteslice_equality() {
496        let a = Value::ByteSlice(Rc::new(b"abc".to_vec()));
497        let b = Value::ByteSlice(Rc::new(b"abc".to_vec()));
498        let c = Value::ByteSlice(Rc::new(b"def".to_vec()));
499        assert!(values_equal_static(&a, &b));
500        assert!(!values_equal_static(&a, &c));
501    }
502
503    #[test]
504    fn test_strview_equality() {
505        let a = Value::StrView(Rc::new(b"test".to_vec()));
506        let b = Value::StrView(Rc::new(b"test".to_vec()));
507        assert!(values_equal_static(&a, &b));
508    }
509
510    #[test]
511    fn test_u8_hash_and_equality() {
512        let a = Value::U8(42);
513        let b = Value::U8(42);
514        let c = Value::U8(99);
515        assert_eq!(value_hash(&a), value_hash(&b));
516        assert_ne!(value_hash(&a), value_hash(&c));
517        assert!(values_equal_static(&a, &b));
518        assert!(!values_equal_static(&a, &c));
519    }
520
521    #[test]
522    fn test_byteslice_clone_shares_rc() {
523        let bs = Value::ByteSlice(Rc::new(b"data".to_vec()));
524        let bs2 = bs.clone();
525        if let (Value::ByteSlice(a), Value::ByteSlice(b)) = (&bs, &bs2) {
526            assert!(Rc::ptr_eq(a, b));
527        } else {
528            panic!("expected ByteSlice values");
529        }
530    }
531
532    #[test]
533    fn test_byteslice_in_detmap() {
534        let mut map = DetMap::new();
535        let key = Value::ByteSlice(Rc::new(b"token".to_vec()));
536        map.insert(key.clone(), Value::Int(1));
537
538        let lookup = Value::ByteSlice(Rc::new(b"token".to_vec()));
539        assert!(map.contains_key(&lookup));
540        match map.get(&lookup) {
541            Some(Value::Int(1)) => {},
542            _ => panic!("expected Int(1)"),
543        }
544    }
545
546    #[test]
547    fn test_murmurhash3_byteslice_stability() {
548        let h1 = murmurhash3(b"hello");
549        let h2 = murmurhash3(b"hello");
550        assert_eq!(h1, h2);
551
552        let h3 = murmurhash3(b"");
553        let h4 = murmurhash3(b"");
554        assert_eq!(h3, h4);
555
556        assert_ne!(murmurhash3(b"hello"), murmurhash3(b"world"));
557    }
558}