@@ -425,6 +425,7 @@ mod db_tests {
425
425
db:: {
426
426
api:: {
427
427
properties:: internal:: { ConstPropertiesOps , TemporalPropertiesRowView } ,
428
+ storage:: graph:: edges:: edge_storage_ops:: EdgeStorageOps ,
428
429
view:: {
429
430
internal:: { CoreGraphOps , EdgeFilterOps , TimeSemantics } ,
430
431
time:: internal:: InternalTimeOps ,
@@ -442,7 +443,7 @@ mod db_tests {
442
443
use itertools:: Itertools ;
443
444
use quickcheck_macros:: quickcheck;
444
445
use raphtory_api:: core:: {
445
- entities:: { GID , VID } ,
446
+ entities:: { EID , GID , VID } ,
446
447
storage:: {
447
448
arc_str:: { ArcStr , OptionAsStr } ,
448
449
timeindex:: TimeIndexEntry ,
@@ -457,6 +458,56 @@ mod db_tests {
457
458
use tempfile:: TempDir ;
458
459
use tracing:: { error, info} ;
459
460
461
+ #[ test]
462
+ fn edge_const_props ( ) {
463
+ let g = Graph :: new ( ) ;
464
+
465
+ g. add_edge ( 0 , 0 , 0 , NO_PROPS , None ) ;
466
+ g. add_edge ( 0 , 0 , 1 , NO_PROPS , None ) ;
467
+
468
+ g. edge ( 0 , 0 )
469
+ . unwrap ( )
470
+ . update_constant_properties (
471
+ vec ! [ ( "x" . to_string( ) , Prop :: map( [ ( "n" , Prop :: U64 ( 23 ) ) ] ) ) ] ,
472
+ None ,
473
+ )
474
+ . unwrap ( ) ;
475
+ g. edge ( 0 , 1 )
476
+ . unwrap ( )
477
+ . update_constant_properties (
478
+ vec ! [ (
479
+ "a" . to_string( ) ,
480
+ Prop :: map( [ ( "a" , Prop :: U8 ( 1 ) ) , ( "b" , Prop :: str ( "baa" ) ) ] ) ,
481
+ ) ] ,
482
+ None ,
483
+ )
484
+ . unwrap ( ) ;
485
+
486
+ let e1 = g. edge ( 0 , 0 ) . unwrap ( ) ;
487
+ let actual = e1
488
+ . properties ( )
489
+ . constant ( )
490
+ . iter ( )
491
+ . map ( |( k, v) | ( k. to_string ( ) , v) )
492
+ . collect :: < Vec < _ > > ( ) ;
493
+ assert ! ( actual. contains( & ( "x" . to_string( ) , Prop :: map( [ ( "n" , Prop :: U64 ( 23 ) ) ] ) ) ) ) ;
494
+
495
+ let e2 = g. edge ( 0 , 1 ) . unwrap ( ) ;
496
+ let actual = e2
497
+ . properties ( )
498
+ . constant ( )
499
+ . iter ( )
500
+ . map ( |( k, v) | ( k. to_string ( ) , v) )
501
+ . collect :: < Vec < _ > > ( ) ;
502
+ assert_eq ! (
503
+ actual,
504
+ vec![ (
505
+ "a" . to_string( ) ,
506
+ Prop :: map( [ ( "b" , Prop :: str ( "baa" ) ) , ( "a" , Prop :: U8 ( 1 ) ) ] )
507
+ ) ]
508
+ ) ;
509
+ }
510
+
460
511
#[ test]
461
512
fn test_empty_graph ( ) {
462
513
let graph = Graph :: new ( ) ;
@@ -486,7 +537,7 @@ mod db_tests {
486
537
) ;
487
538
assert_eq!(
488
539
graph. const_prop_values( ) . collect:: <Vec <_>>( ) ,
489
- Vec :: <Prop >:: new( )
540
+ Vec :: <Option < Prop > >:: new( )
490
541
) ;
491
542
assert!( graph. constant_prop( 1 ) . is_none( ) ) ;
492
543
assert!( graph. get_const_prop_id( "1" ) . is_none( ) ) ;
0 commit comments