I'm new to UVM and SVunit. As i'm trying to write a unit test for scoreboard, I found that if the uvm_analysis_imp port is instantiated in build phase of scoreboard and if we connect it to a uvm_analysis_port in build function of scoreboard_unit_test module, there will be a null handle problem. It seems that the build phase of scoreboard is executed later than the build() function inside module. If I put the instatiation of the uvm_analysis_imp into constructor of scoreboard, there will be no problem. But we cannot simply change the UUT to fit our test right? If I still want to keep every instatiation inside build phase, what can i do with this problem?
I think you want to instantiate the TLM ports in SV to transfer data from SVunit to UVM and also make syncrhonisation. My belive is that you cannot use uvm_analysis_imp port in SVunit, becuase SVunit just dont know what object is this.
I think you need to make the synchronisation between SVunit and UVM code in run_phase of UVM.
So you can define either some event to make their synchronisation, than use another function to transfer data. Or you can user mailbox there
Related
I am new to Unreal (switched from Unity) and still have some troubles understanding the main concepts, in this case how to access other objects and their components via c++ scriptig. I am using UE5 (but I guess solutions for UE4 should also work fine).
My Project looks as followed:
In my scene I have an "Target" Actor (Blueprintclass) that has a self written c++ "movement" component with some public function to update its position.
More over I have an "Experiment" BP Actor that has a "TrialProcedure" c++ component attached.
Here is what I want to do: I want to run the Target's movent component's update position function from this Actor's component.
I guess once I can access the Target Actor, I can use GetComponentByClass() to access the component I need and than run it's method. But how do I get access to that other actor without using blueprints? The Actor is already there so I don't want to spawn it from code.
Thanks in advance!
That is a sub-optimal solution. Use a collision and get the Other Actor, then try to cast it to your desired class if it's a collision event. If it fails, don't do anything but if it doesn't, pull a pin from that and execute your functions.
A better alternative to your current solution would be to use the Get All Actors of Class function if you only have a single target. Just use the Get (a copy) node and you'll have your target blueprint. There's a C++ version of the function as well. If you have more than one file, then you'll have to check stuff.
Before asking the question, I should say this. My understanding about UI Testing in Xcode:
UI Tests is only for automating the UI work flow
The original source can not be accessible to the end user. In the same way, UI Tests can not access the source code of the app
Only element properties/identifiers can be accessible within the UI Test cases.
My scenario:
I want to call a method (Say myMethod()) in the view controller (Say MyVC.h/MyVC.m) in my source code from my UI Test case.
Note: My source code was written in Objective C, and I am writing test cases in Swift.
From my understanding, to do this, I should add MyVC.m(We can not add .h to the target) in UITest target also. Then I need to import MyVC.h in my UITest bridging file. Then I can call myMethod() from UITest like this:
MyVC.myMethod()
It will work!!
The problem:
In real time, most of the classes use Util classes, Constant files(Header files), classes that was imported from .pch file, Shared managers, etc.
If MyVC is a independent class, means which will not use any of the classes said above, I can access myMethod() without any problem.
But, if MyVC uses those classes indirectly, running UITest shows missing header files errors in all source code.
What I tried:
To resolve this problem, I tested by adding all source files into the UI target. Still those problem happens. Since I can not able to add .h files
I created Unit test class where I can call any class's methods (Because unit test class having an option "Allow testing Host Application APIs"). Then I tried to access Unit test case from UI Test case. Here also the same error happens in each file.
Question:
Should I add all needed files header in all files of main source?
Have anyone faced this type of error? Did anyone done DB access from UI Testing?
Two things:
The latter half of your question seems to deal with the build problems. For those, yes, you need all dependencies in the target.
The title of the question asks about calling a method in the tested app from a UI test. UI tests run in a different process from the app, so you can't just access an object in the app. You need to either move the trigger in-band by adding accessible UI, or rig up a side channel, which might be doable using say a local socket.
I think the second bit might not matter for your needs, since from the bit about hitting a database from the UI test makes it sound like you don't need the specific object in the app, just an object of that class to get at some DB access methods that are declared on it for some reason. For that, just being able to compile in the class and instantiate and message it suffices. (You might still make your life easier by factoring those DB-related methods out to a non-UI class, though.)
I just started coding VST plugins. But since I'm on a mac I would also like to build Audio Units. I managed to compile some sample code and these components showed up inside my Logic DAW.
In VST there's the possibility to create a plugin shell. This describes a single 'dll'/'vst' file which has multiple effects in it. During startup the host calls a function called getNextShellPlugin and the plugin dynamically registers its content at runtime. The effects then perfectly show up in a plugin list.
Is there a similar way I can achieve this with Audio Units?
I managed to get a plugin shell by adding another component description to the 'info.plist'. But I have to hardcode every effect in there and that's not what I want.
I also tried to use AudioComponentRegister but this didn't work properly for me. Since therefore the component has to be instanciated so I can call this function inside the constructor. But to list the components inside Logic they need to be found during the scan where the component will not get instanciated by default.
So the goal is to register multiple effects inside 1 component at runtime.
Does someone maybe have a tip or a solution? Thanks a lot!
I'm currently working on a little project in C++. I'm fairly new to C++/Programming and wanted to ask how my classes should be designed.
To be specific: I want to write a little program for chatting. Just simple communication between two programs/computers. For that I want to use a good class design because, although it is only a small project (just for the sake of learning), I want it to be well designed and extensible.
My program should have about 5 classes (Handlers etc, the Updater and App - the main class only for this program).
I'll give you a few examples of ideas I have how I could design one part of the program. The first part should be the connection part (handled by Connection). The task is to build up a connection between the two programs. It will also set up local files, which will hold the information to print, and connect it to the 'server' file. Later in the program there should be access to the File_Handler class so it can edit/read the local file and read/request to write to the 'server' file. (How exactly it's gonna do it is already figured out, so as long as it is not necessary I'd like to keep this system as it is ;) ). But now let's get to the ideas I have:
Idea 1
App creates an instance of Connection to set up the connection.
Connection then creates an instance of File_Handler which will set up the files (in this case File_Hanlder would hold the paths with static variables) and then destroy that instance because it is no longer needed by Connection.
Another class (instance is held by App) then creats an own instance of File_Hanlder later and could work with the files since the variable for the path is static.
Idea 2
App creates an Instance of Connection and File_Handler (lets call them con and fil).
To set up the connection, fil is passed per reference to con to set up the variable paths for the files and create the files etc. .
For working with the files later, App would pass around fil to manage all the file handling for the other classes which would, for example, update the chat etc.
That would require a lot of classes to have a constructor or (a) function(s) which needs to have a File_Handler parameter and the same variable would be passed around a lot of times.
Idea 3
The last idea I have is that Connection, File_Handler and the other classes would be created very general without any or near to zero relation to other classes.
App then creates a lot of functions (or even 'subclasses') to work with these classes almost like working with Frameworks which were developed independently and thus could, theoraticly, be used in another program without any problems.
Which solution do you think would be the best? Or is there another solution you have for me which would be even better?
For Unit Testing, I'm trying to record all the state transactions after I kick off a state machine event.
E.g., if I post_event A to the fifo_scheduler of an async_state_machine, the state machine will go through states B, C, then back to D.
Without being able to record all the event states, I can only check that it went to State D after it was done when doing a unit test :-(
The only thing I can think of is to modify all the react methods or constructors of all the states I create (derived off simple_state) so they do the recording. This seems a bit hackish when I really want to hook into the async_state_machine just before it calls a state's react() method...
This seems a bit hackish when I really want to hook into the async_state_machine just before it calls a state's react() method...
Why don't you? Create a new class that extends async_state_machine and add your desired hooks into it. If access is a problem (It probably will be), do the ever spectacular #define private public (or protected hack before including statechart.
I've done something similar to add local variables to the history of a state and add a new kind of state-ctor so I have for-real full history.
Added a different hack. Each State is created before it's used by the boost state machine (then destroyed after it goes to the next state...seems so inefficient), so each state was derived from another class that has a callback in it's constructor.
Still seems kinda hackish...wish boost++ had a cleaner way to do this :-P