00:27:14 -!- amalloy_ is now known as amalloy 01:03:02 Corinon (L11 FoFi) ASSERT(isnormal(n)) in 'ray.cc' at line 189 failed. (D (Sprint)) 01:21:41 Experimental (bcrawl) branch on underhound.eu updated to: 0.23-a0-3603-ge1cc4b0452 01:51:52 does claw have a default namespace to hide implementation details? 02:06:11 usually we add underscore to functions that are implementation details. 02:06:32 What to do if I want to hide a class? 02:15:54 don't put it in the header 02:17:31 CrawlCycle: that's what really determines what's "hidden" vs exported. a _ prefix is just a convention for readability 02:20:04 i made a class for defining a global guard for running the initialization steps of crawl. 02:20:27 some of those init steps have no corresponding clean up functions. 02:20:59 that means i can only run them once across all the tests 02:21:59 I want to expose the instantiation (the global guard) of that class 02:22:20 but i want to hide the class's definitions as implementation details. 02:22:54 the thing get worse because the guard class uses another class that i also want to hide. 02:23:23 the include file of all these class contains the declaration of the classes and the instantiation of the global guard 02:24:50 if i don't hide the instantiation, can i hide the declaration? 02:25:42 you can put a stub in the header, if you want the type to be known but opaque. foo.h: class foo; foo.cc: class foo {...} 02:26:39 tried that ... 02:27:14 maybe i did something wrong 02:27:22 it is not a templated class 02:28:28 amalloy, but both the instantiation and declaratio are in the header. 02:28:41 foo.h: class foo; foo(); 02:28:59 foo.cc: foo::foo() {} 02:30:25 foo.h: class Foo; static Foo foo(); 02:30:34 let's see i can compile a cut-down version. 02:32:57 nope 02:33:42 test.h: class A; static A a; 02:34:38 test.cc: 02:34:43 #include "test.h" 02:34:45 class A { 02:34:49 public: 02:34:59 A() {} 02:35:01 }; 02:35:09 test.h: 02:35:16 class A; 02:35:20 static A a; 02:35:59 error: aggregate `A a` has incomplete type and cannot be defined. 02:36:36 i don't think this can work. I need a full definition to instantiate a class. 02:36:49 if I instantiate the class within the header 02:37:11 i can't just put a forward declaration in the header 02:41:34 right now, i put the class's declaration in detail namespace in the header 02:42:16 i don't like global variables... 02:45:32 Monster database of master branch on crawl.develz.org updated to: 0.26-a0-667-g92642533e4 02:47:59 i don't think you know what static does in c++. what you wrote would create N distinct A objects if the header is included in N different files 02:49:40 you probably mean extern, if you want it to be visible to clients but defined elsewhere. see how player.hs defines `extern player you;` 02:51:09 should be extern 02:52:46 thanks. i learn c++ on my own. 02:53:03 so probably there are still a lot of things to learn 02:54:02 but one problem though. where to instantiate that global variable? 02:54:27 a bunch of tests will use that fixture 02:54:43 i mean a bunch of test_xyz.cc files will use that fixture 02:55:01 then all those .cc files get linked into a single catch2-test-executable 02:55:24 do i really have to use a singleton? 02:56:06 i don't think instantiating that global within the test_xyz.cc files make sense. 02:56:28 if one developer instantiate it in one test_xyz.cc 02:56:34 another developer does the same thing 02:56:41 then there will be problems 02:56:45 multiple definition 02:58:23 there is only one fixture file. the fixture gets setup and tear down in each test. 02:58:23 if i instantiate the global within the dlua_fixture.cc 02:58:33 it may work. 03:00:11 i don't really understand what you're trying to build. i've just given some pretty general c++ feedback when you say something that doesn't sound right 03:02:10 thanks. i was thinking out loud, after asking the question. 03:05:29 in particular, you've said your thing will be initialized only once globally, but also talked about initializing it in each test 03:07:18 one guard for init steps of crawl 03:07:30 the fixture use the guard 03:07:52 the fixture gets create and destroyed during running of each test 03:08:35 i can't do the instantiation of the guard in the main function 03:09:34 because not all tests use the guard. 03:09:34 the fixture that i am writing enable using dungeon builder lua commands in the unit tests 03:09:41 the old and existing catcher2 tests don't need to run dlua commands. 03:10:43 in the current build process, all the test_xyz.cc files in catch2-test/ directory get linked to test_main.cc, which #include the fake-main.cc in the main source. 03:11:41 if i put the instantiation of my init guard into test_main.cc, then the old tests will have access to my guard too. 03:12:14 maybe that is not too bad. 03:13:50 everything gets compiled into a single catch2-test-executable anyway. 03:19:11 alternatively, just instantiate in the guard's header 03:19:34 then use extern to refer to that global in the fixture's .cc 03:20:05 since the header only gets include once, i only have one instantiation 03:20:46 and the externs would all refer to that single instantiation in the header. 03:20:51 just don't declare the guard's instantiation as static. 03:21:06 that sounds better. 03:30:57 Fork (bcrawl) on crawl.kelbi.org updated to: 0.23-a0-3603-ge1cc4b0452 03:47:45 Fork (bcadrencrawl) on crawl.kelbi.org updated to: 0.22.1-3058-g7dd4cf362e 08:53:00 -!- amalloy is now known as amalloy_ 09:47:34 what is the difference between dlua and clua? 09:47:55 dlua looks like dungeon builder lua. But what is clua? 09:53:12 <12e​bering> clua is "client lua" and is used for player RC scripting 09:54:10 <12e​bering> CrawlCycle: while on the one hand we do appreciate testing and documentation efforts, on the other hand it seems you're still very new to the codebase relative to the ambition of your project (which, I'm still not completely clear on; it looks like you started out trying to make a "unit test" for actor_near_iterator) 09:55:10 it is a fixture for using dlua commands in catcher2-test 09:55:42 it is nearly done now. i am writing unit tests to test the fixture. 09:56:11 the use case is to use dlua to set up scenario 09:56:17 and use c++ to write the test 09:56:25 <12e​bering> We already have an "integration testing" framework purely in lua 09:56:28 to avoid writing lua binding for everything that i want to test. 09:56:37 <12e​bering> Well yes that's what I'm getting at 09:56:37 for example, the iterator. 09:56:57 <12e​bering> I don't think that iterator is worth this effort to test; it's straightforward, hasn't been touched in years, and hasn't contributed a bug in years. 09:57:37 <12e​bering> Crawl's codebase is highly cross-loaded: something that looks like it should be a "unit" (i.e. actor_near_iterator) depends on tons of global state, which makes it a better candidate for integration/stress testing for coverage 09:58:32 <12e​bering> And, in the long run, a better approach to testing these "units" would be to re-factor them so they can be tested without initializing a large part of crawl's global state 09:59:07 during this refactoring, how to ensure that we haven't broken things? 10:00:28 <12e​bering> code review, hope, and the large scale integration testing that is our live trunk deployment to thousands of beta test players worldwide 10:00:30 i think that temporary doc and test are a step in doing this. 10:00:42 but i am not sure if that is the best way to do it. 10:02:25 <12e​bering> Consider: as the effort and complexity of a temporary test grows, how likely is it to become permanent and a burden 10:03:15 hmm. what are the potential disadvantages? 10:04:08 obviously, i don't see them when i work on the tests. 10:04:08 when a developer come by and work on the refactoring 10:04:08 what would happen? 10:04:30 the developer look at the doc and the test 10:04:37 <12e​bering> Lets focus on the specific case of actor_near_iterator 10:04:37 to see what is the original behavior 10:04:43 oh 10:05:06 <12e​bering> It must 10:08:19 <12e​bering> I guess, what I want to say is: the past week of these chat logs have been you delving into the complexities of this project, providing dlua support for writing unit tests, which is decidedly not a unit test, all for the sake of testing an iterator that as far as I can tell has never generated a bug 10:09:04 <12e​bering> if it's about ensuring that in some hypothetical refactor actor_near_iterator maintains its contract, a short snippet of documentation of the class describing that contract will suffice 10:09:44 <12e​bering> the iterator is not long nor complex 10:09:44 <12e​bering> it's also not totally clear to me what an appropriate refactor would be 10:09:54 yea. i don't think it needs to be changed. 10:09:55 <12e​bering> since actor_near_iterator, by definition, references the global state of the game 10:10:40 i see a lot of things use the monster_near_iterator 10:10:50 which is similar to the actor_near_iterator 10:11:11 so i decided to write doc and test 10:11:35 well, in fairness, |amethyst and I both suggested the other day that testing some aspects of that iterator would be reasonable 10:11:39 i hope the dlua support make setting up scenarios for writing tests easier. 10:11:58 I did try to suggest this would be better done via a lua test though 10:12:50 but i don't like changing the source code to add lua binding for writing just a test... 10:13:02 writing test should not change the source code 10:13:37 <12e​bering> I think my skepticism of testing is in part my mathematican's accent: we should just formally verify crawl! 10:14:37 i totally believe in you guys know more and better than me 10:15:27 just that i agree using c++ to set up test scenario is tedious. 10:15:43 and dlua is easier. 10:16:03 <12e​bering> Writing integration tests can definitely require a change to the source. I would argue that while something like "actor_near_iterator" appears to be a low-level unit, because it is an iterator over rather high-level global state, testing it is an integration exercise, not a unit exercise 10:16:18 <12e​bering> So yes, dlua, part of our integration automation, makes it easier 10:16:30 <12e​bering> but in order to test more with lua tests, you must expose more to lua 10:16:43 <12e​bering> which requires writing lua bindings 10:23:49 many things are like that. for example, any function that works on the player (the you object). so, what needs unit testing? 11:53:09 An alternative would be try to do a real mock of crawl's environment. 11:53:32 for example, a mock environment object 11:54:07 that is actually an interface 11:54:20 and we can choose what to implement in each test 11:54:30 and only implement the minimal requirement for each test 11:54:43 all the implementations are organized into a library 11:55:03 that we can select and use sparingly for each test. 11:55:29 The current catch2-tests don't do this. the catch2-test-executable uses fake-main 11:56:40 This is the hardway. mock with dependency inversion. 11:56:59 probably the correct way. 11:59:28 but this way still has some problems. 11:59:38 Each change to the crawl's environment object 11:59:49 would require a corresponding manual change of the mock 12:00:15 i guess this is an acceptable cost. 12:02:23 or maybe not. 12:04:33 the environment object contains the monster array, which contains the monster object 12:04:46 a change to the definition of the monster or actor class 12:04:53 would require a corresponding mock. 12:06:07 the dlua fixture would at least avoid writing new lua bindings when we write new integration tests. 12:08:01 A real mock would surely not change even when the main source change. 12:09:05 A cut-down initialization of crawl would not change *most* of the time when the main source change. That means test scenario needs its own check before we use those scenario to test other things. 12:10:07 which way is better? real mock or scenarios? 13:55:34 03PleasingFungus02 07[bogged-down] * 0.26-a0-668-g206a269: Buff bog bodies 10(8 weeks ago, 1 file, 2+ 2-) 13https://github.com/crawl/crawl/commit/206a2694b21b 13:55:34 03PleasingFungus02 07[bogged-down] * 0.26-a0-669-g60eb314: New monster: bloated husk 10(8 weeks ago, 6 files, 42+ 0-) 13https://github.com/crawl/crawl/commit/60eb3143ebc3 13:55:34 03PleasingFungus02 07[bogged-down] * 0.26-a0-670-g010d1bb: New monster: bunyip 10(8 weeks ago, 7 files, 33+ 0-) 13https://github.com/crawl/crawl/commit/010d1bba03fe 13:55:34 03PleasingFungus02 07[bogged-down] * 0.26-a0-671-gd384799: New monster: devouring swarm 10(8 weeks ago, 30 files, 180+ 5-) 13https://github.com/crawl/crawl/commit/d384799eee78 13:55:34 03PleasingFungus02 07[bogged-down] * 0.26-a0-672-g4d30ca1: Power up insubstantial wisps 10(8 weeks ago, 4 files, 55+ 2-) 13https://github.com/crawl/crawl/commit/4d30ca1ca598 13:55:34 03PleasingFungus02 07[bogged-down] * 0.26-a0-673-ge2766cd: New monster: Kitsune 10(8 weeks ago, 11 files, 63+ 9-) 13https://github.com/crawl/crawl/commit/e2766cd67760 13:55:34 03PleasingFungus02 07[bogged-down] * 0.26-a0-674-g4199943: New monster: goliath frog 10(8 weeks ago, 14 files, 57+ 16-) 13https://github.com/crawl/crawl/commit/4199943f93d8 13:55:34 03PleasingFungus02 07[bogged-down] * 0.26-a0-675-gd8f4298: New monster: eleionoma 10(8 weeks ago, 14 files, 150+ 3-) 13https://github.com/crawl/crawl/commit/d8f4298187a0 13:55:34 03PleasingFungus02 07[bogged-down] * 0.26-a0-676-g15186a6: Remove unused M_HYBRID flag 10(8 weeks ago, 1 file, 1+ 1-) 13https://github.com/crawl/crawl/commit/15186a6d47b5 13:55:34 03PleasingFungus02 07[bogged-down] * 0.26-a0-677-gc08c92f: Sq into el 10(8 weeks ago, 1 file, 2+ 2-) 13https://github.com/crawl/crawl/commit/c08c92f68e64 13:55:34 ... and 22 more commits 13:55:53 Branch pull/1533 updated to be equal with bogged-down: 13https://github.com/crawl/crawl/pull/1533 14:19:50 <10P​leasingFungus> 8 weeks ago... time flies 14:44:51 can gmock mock global object, like the (player you;) object? 14:46:32 the player class is not even an interface. not sure if gmock can directly work with that. 15:00:36 ok.. but i can make a new main function for the test 15:00:52 and replacing the original game state by an interface 15:00:56 and then use gmock 15:10:46 seems not easy to use gmock with catch2 17:46:15 -!- amalloy_ is now known as amalloy 22:38:05 in l-you.cc the deprecated LUAFN(you_mutation) only takes 1 string argument and returns an int. 22:39:39 nvm. i figure it out. lua "you.mutate" binds to another c++ function. 23:19:35 vortex (L7 DEFE) ASSERT(you.equip[slot] == -1) in 'player-equip.cc' at line 58 failed. (D:4) 23:24:18 does dlua allow us to get return value from a lua command? 23:28:56 i think dlua can't do that, after skimming over all calls to dlua.xyz methods. 23:29:29 !crashlog 23:29:31 22621. vortex, XL7 DEFE, T:3347 (milestone): https://cbro.berotato.org/morgue/vortex/crash-vortex-20201018-031933.txt 23:31:16 what does that crashlog tell? 23:31:32 amulet of guardian spirit? or something else? 23:33:28 equip on delay 23:36:50 the log suggests that somehow the player started two equip delays 23:37:05 no idea how 23:38:06 vortex (L8 DEFE) ASSERT(you.equip[slot] == -1) in 'player-equip.cc' at line 58 failed. (D:6) 23:38:54 wow. i can't figure that out even after reading EquipOnDelay 23:39:22 how did you figure that out? 23:41:51 is it possible to get a save game, seed, and replay the player's actions? 23:50:42 generally only devs can access online saves, and only if you can get player to make one first via console menu 23:53:56 !crashlog 23:53:57 22622. vortex, XL8 DEFE, T:5156 (milestone): https://cbro.berotato.org/morgue/vortex/crash-vortex-20201018-033805.txt 23:54:18 &rc vortex 23:54:19 ?rc vortex git 23:54:28 %rc vortex git 23:54:29 http://dobrazupa.org/rcfiles/crawl-git/vortex.rc 23:56:56 seems that lua is the problem, i'd guess that it.puton doesn't check whether it's already on