MCPcopy Create free account
hub / github.com/clockworklabs/SpacetimeDB / test_primitives

Function test_primitives

crates/pg/src/encoder.rs:197–237  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

195
196 #[tokio::test]
197 async fn test_primitives() {
198 let schema = ProductType::from([
199 AlgebraicType::U8,
200 AlgebraicType::I8,
201 AlgebraicType::I16,
202 AlgebraicType::U16,
203 AlgebraicType::I32,
204 AlgebraicType::U32,
205 AlgebraicType::I64,
206 AlgebraicType::U64,
207 AlgebraicType::I128,
208 AlgebraicType::U128,
209 AlgebraicType::I256,
210 AlgebraicType::U256,
211 AlgebraicType::F32,
212 AlgebraicType::F64,
213 AlgebraicType::String,
214 AlgebraicType::Bool,
215 ]);
216 let value = product![
217 1u8,
218 -1i8,
219 -2i16,
220 3u16,
221 -4i32,
222 5u32,
223 -6i64,
224 7u64,
225 Packed::from(-8i128),
226 Packed::from(9u128),
227 i256::from(-10),
228 u256::from(11u128),
229 12.34f32,
230 56.78f64,
231 "test".to_string(),
232 true,
233 ];
234
235 let row = run(schema, value).await;
236 assert_eq!(row, "\0\0\0\u{1}1\0\0\0\u{2}-1\0\0\0\u{2}-2\0\0\0\u{1}3\0\0\0\u{2}-4\0\0\0\u{1}5\0\0\0\u{2}-6\0\0\0\u{1}7\0\0\0\u{2}-8\0\0\0\u{1}9\0\0\0\u{3}-10\0\0\0\u{2}11\0\0\0\u{5}12.34\0\0\0\u{5}56.78\0\0\0\u{4}test\0\0\0\u{1}t");
237 }
238
239 #[tokio::test]
240 async fn test_enum() {

Callers

nothing calls this directly

Calls 1

runFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…