MCPcopy Create free account
hub / github.com/erans/pgsqlite / test_sign

Function test_sign

src/functions/math_functions.rs:487–511  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

485
486 #[test]
487 fn test_sign() {
488 let conn = Connection::open_in_memory().unwrap();
489 register_math_functions(&conn).unwrap();
490
491 let result: f64 = conn.query_row(
492 "SELECT sign(5.5)",
493 [],
494 |row| row.get(0)
495 ).unwrap();
496 assert_eq!(result, 1.0);
497
498 let result: f64 = conn.query_row(
499 "SELECT sign(-3.2)",
500 [],
501 |row| row.get(0)
502 ).unwrap();
503 assert_eq!(result, -1.0);
504
505 let result: f64 = conn.query_row(
506 "SELECT sign(0.0)",
507 [],
508 |row| row.get(0)
509 ).unwrap();
510 assert_eq!(result, 0.0);
511 }
512
513 #[test]
514 fn test_power_sqrt() {

Callers

nothing calls this directly

Calls 2

register_math_functionsFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected