Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

39
LINES

< > BotCompany Repo | #1031046 // Test conceptShadow_rawMap & ConceptShadow (OK)

JavaX source code (Dynamic Module) [tags: use-pretranspiled] - run with: Stefan's OS

Libraryless. Click here for Pure Java version (20825L/140K).

!7

set flag ConceptRef_markInToString.
//set flag MetaTransformer_debug.

concept Bla {
  S name;
  new Ref myRef;
  new RefL<Bla> references;
}

module > DynPrintLog {
  start-thread {
    new Concepts cc;
    Bla a = cnew(cc, Bla, name := "a");
    Bla b = cnew(cc, Bla, name := "hello", whatever := 123, ref := a, myRef := a,
      references := ll(a, a));
    pnl(conceptShadow_rawMap(a));
    ConceptShadow shadow = ConceptShadow(a);
    print(shadow);
    pnl(conceptShadow_rawMap(b));
    shadow = ConceptShadow(b);
    print(shadow);
    assertEqualsVerbose(getClassName(Bla), shadow.get(":class"));
    assertEqualsVerbose(ConceptID(a.id), shadow.get("ref"));
    assertEqualsVerbose(ConceptID(a.id), shadow.get("myRef"));
    assertEqualsVerbose(ll(ConceptID(a.id), ConceptID(a.id)), shadow.get("references"));
    assertEqualsVerbose(b.id, shadow.get("id"));
    assertEqualsVerbose("hello", shadow.get("name"));
    
    // check that 2 shadows of same unchanged object are equal
    assertEqualsVerbose(shadow, ConceptShadow(b));
    
    // change object
    cset(b, name := "newName");
    ConceptShadow shadow2 = new(b);
    assertNotEqualsVerbose(shadow, shadow2);
  }
}

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt

No comments. add comment

-
Snippet ID: #1031046
Snippet name: Test conceptShadow_rawMap & ConceptShadow (OK)
Eternal ID of this version: #1031046/24
Text MD5: c191827d7f94d8b411b6a9b62e1c3d64
Transpilation MD5: b43e46c4a6d761c0363fce5aab24ffda
Author: stefan
Category: javax
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-05-01 15:45:53
Source code size: 1226 bytes / 39 lines
Pitched / IR pitched: No / No
Views / Downloads: 262 / 576
Version history: 23 change(s)
Referenced in: