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).

1  
!7
2  
3  
set flag ConceptRef_markInToString.
4  
//set flag MetaTransformer_debug.
5  
6  
concept Bla {
7  
  S name;
8  
  new Ref myRef;
9  
  new RefL<Bla> references;
10  
}
11  
12  
module > DynPrintLog {
13  
  start-thread {
14  
    new Concepts cc;
15  
    Bla a = cnew(cc, Bla, name := "a");
16  
    Bla b = cnew(cc, Bla, name := "hello", whatever := 123, ref := a, myRef := a,
17  
      references := ll(a, a));
18  
    pnl(conceptShadow_rawMap(a));
19  
    ConceptShadow shadow = ConceptShadow(a);
20  
    print(shadow);
21  
    pnl(conceptShadow_rawMap(b));
22  
    shadow = ConceptShadow(b);
23  
    print(shadow);
24  
    assertEqualsVerbose(getClassName(Bla), shadow.get(":class"));
25  
    assertEqualsVerbose(ConceptID(a.id), shadow.get("ref"));
26  
    assertEqualsVerbose(ConceptID(a.id), shadow.get("myRef"));
27  
    assertEqualsVerbose(ll(ConceptID(a.id), ConceptID(a.id)), shadow.get("references"));
28  
    assertEqualsVerbose(b.id, shadow.get("id"));
29  
    assertEqualsVerbose("hello", shadow.get("name"));
30  
    
31  
    // check that 2 shadows of same unchanged object are equal
32  
    assertEqualsVerbose(shadow, ConceptShadow(b));
33  
    
34  
    // change object
35  
    cset(b, name := "newName");
36  
    ConceptShadow shadow2 = new(b);
37  
    assertNotEqualsVerbose(shadow, shadow2);
38  
  }
39  
}

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: 263 / 579
Version history: 23 change(s)
Referenced in: [show references]