Skip to content

Commit

Permalink
experimenting
Browse files Browse the repository at this point in the history
  • Loading branch information
Wandalen committed Mar 27, 2024
1 parent 84c19a9 commit aaf6119
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,11 @@ fn definitions()
{
}

// f1( former::VectorDefinition::< String, () >::default() );
f1( former::VectorDefinition::< String, (), Vec< String >, the_module::NoEnd >::default() );
f2( former::VectorDefinition::< String, (), Vec< String >, the_module::NoEnd >::default() );
f3::< former::VectorDefinition< String, (), Vec< String >, the_module::NoEnd >, the_module::ReturnStorage >( the_module::ReturnStorage );
f3::< < former::VectorDefinition< String, (), Vec< String >, the_module::NoEnd > as the_module::FormerDefinition >::Types, the_module::ReturnStorage >( the_module::ReturnStorage );

// assert_eq!( 0, 1 );

let vec : Vec< String > = vec![ "a".into(), "b".into(), "c".into() ];

}

//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,71 @@ use collection_tools::HashMap;
// qqq : zzz : remove #[ cfg( not( feature = "use_alloc" ) ) ]
#[ cfg( not( feature = "use_alloc" ) ) ]
#[ test ]
fn push()
fn add()
{

//
// expliccit with ContainerSubformer

let got : HashMap< String, String > = the_module
::ContainerSubformer
::< ( String, String ), former::HashMapDefinition< String, String, (), HashMap< String, String >, the_module::ReturnStorage > >
::new( former::ReturnStorage )
.add( ( "a".into(), "x".into() ) )
.add( ( "b".into(), "y".into() ) )
.form();
let exp = hmap!
[
"a".to_string() => "x".to_string(),
"b".to_string() => "y".to_string(),
];
a_id!( got, exp );

// expliccit with HashMapSubformer

let got : HashMap< String, String > = the_module::HashMapSubformer::< String, String, (), HashMap< String, String >, the_module::ReturnStorage >
::new( former::ReturnStorage )
.add( ( "a".into(), "x".into() ) )
.add( ( "b".into(), "y".into() ) )
.form();
let exp = hmap!
[
"a".to_string() => "x".to_string(),
"b".to_string() => "y".to_string(),
];
a_id!( got, exp );

// compact with HashMapSubformer

let got : HashMap< String, String > = the_module::HashMapSubformer::new( former::ReturnStorage )
.add( ( "a".into(), "x".into() ) )
.add( ( "b".into(), "y".into() ) )
.form();
let exp = hmap!
[
"a".to_string() => "x".to_string(),
"b".to_string() => "y".to_string(),
];
a_id!( got, exp );

// with begin

let got : HashMap< String, String > = the_module::HashMapSubformer
::begin( Some( hmap![ "a".to_string() => "x".to_string() ] ), Some( () ), former::ReturnStorage )
.add( ( "b".into(), "y".into() ) )
.form();
let exp = hmap!
[
"a".to_string() => "x".to_string(),
"b".to_string() => "y".to_string(),
];
a_id!( got, exp );

// with help of ext

let got : HashMap< String, String > = the_module::HashMapSubformer::new()
.insert( "a", "x" )
.insert( "b", "y" )
use the_module::HashMapExt;
let got : HashMap< String, String > = HashMap::former()
.add( ( "a".into(), "x".into() ) )
.add( ( "b".into(), "y".into() ) )
.form();
let exp = hmap!
[
Expand All @@ -24,6 +81,8 @@ fn push()
];
a_id!( got, exp );

//

}

// qqq : zzz : remove #[ cfg( not( feature = "use_alloc" ) ) ]
Expand All @@ -32,9 +91,9 @@ fn push()
fn replace()
{

let got : HashMap< String, String > = the_module::HashMapSubformer::new()
.insert( "x", "x" )
.replace( hmap![ "a".to_string() => "x".to_string(), "b".to_string() => "y".to_string() ] )
let got : HashMap< String, String > = the_module::HashMapSubformer::new( former::ReturnStorage )
.add( ( "x".to_string(), "y".to_string() ) )
.replace( hmap![ "a".to_string() => "x".to_string(), "b".to_string() => "y".to_string(), ] )
.form();
let exp = hmap!
[
Expand All @@ -44,4 +103,3 @@ fn replace()
a_id!( got, exp );

}

4 changes: 2 additions & 2 deletions module/core/former/tests/inc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ mod former_tests
mod container_former_vec;
#[ cfg( any( not( feature = "no_std" ), feature = "use_alloc" ) ) ]
mod container_former_hashset;
// #[ cfg( any( not( feature = "no_std" ), feature = "use_alloc" ) ) ]
// mod container_former_hashmap;
#[ cfg( any( not( feature = "no_std" ), feature = "use_alloc" ) ) ]
mod container_former_hashmap;

// mod a_primitives_manual;
// mod a_primitives;
Expand Down

0 comments on commit aaf6119

Please sign in to comment.