engine_web-ifc icon indicating copy to clipboard operation
engine_web-ifc copied to clipboard

Automated Test Suite

Open cdiggins opened this issue 2 years ago β€’ 13 comments

This project would benefit from an automated test suite, even including some known failures. Perhaps using the files posted here https://github.com/IFCjs/test-ifc-files . Adding some of the files submitted in Github issues could be added to a "failing" folder.

cdiggins avatar Nov 30 '21 14:11 cdiggins

Agreed. Check out this coming PR for including a testing harness that we can use to do what you suggest.

awmartin avatar Dec 01 '21 16:12 awmartin

This issue is now a bounty. Whoever solves this will get $200. More information here.

agviegas avatar May 15 '22 23:05 agviegas

::take

TxTony avatar Sep 16 '22 16:09 TxTony

🟒🟒🟒

::take

Hi, @TxTony! Thanks for taking this bounty! The due date is October 7, 2022 UTC.

If you need to submit some pull requests (PR) to complete the tasks, make sure that the last and only the last PR has a title that either starts with the bounty ID or is exactly the same as the bounty name. After the PR is merged, this bounty’s status will automatically changed to done.

If you do not need to make a PR, tell the manager @agviegas to run ::done command after your tasks is confirmed to be done.

Good luck!

agviegas avatar Sep 16 '22 16:09 agviegas

Hi @agviegas,

first question

about the functions below. I admit the returns are actually correct. The return types are good. But I don't know if this is the expected result. do you think i can considered the test ok if the return type is good ? ( without checking the expected result)

    GetCoordinationMatrix(modelID: number): Array<number>
    {
        return this.wasmModule.GetCoordinationMatrix(modelID) as Array<number>;
    }

    GetVertexArray(ptr: number, size: number): Float32Array
    {
        return this.getSubArray(this.wasmModule.HEAPF32, ptr, size);
    }

    GetIndexArray(ptr: number, size: number): Uint32Array
    {
        return this.getSubArray(this.wasmModule.HEAPU32, ptr, size);
    }

    getSubArray(heap, startPtr, sizeBytes) {
        return heap.subarray(startPtr / 4, startPtr / 4 + sizeBytes).slice(0);
    }
     /**  
     * Load geometry for a single element
     * @modelID Model handle retrieved by OpenModel
    */
    GetFlatMesh(modelID: number, expressID: number): FlatMesh
    {
        return this.wasmModule.GetFlatMesh(modelID, expressID);
    }

second question

By the way could you tell me in which case we can use these function ?

If I'm right these function give me informations about geometries applied on one entity like this exemple.

  let flatMesh = IfcApi.GetFlatMesh(0, expressID);
  let geometrieSize = flatMesh.geometries.size();
  for (let index = 0; index < geometrieSize; ++index) {
      let geometries = IfcApi.GetGeometry(0, flatMesh.geometries.get(index).geometryExpressID);
      let geometryVertexArray = IfcApi.GetVertexArray(geometries.GetVertexData(), geometries.GetVertexDataSize());
      let geometryIndexData = IfcApi.GetIndexArray(geometries.GetIndexData(), geometries.GetIndexDataSize());
  }

Do not hesistate to tell if your busy in this case I will release a first draft with the minimum for theses functions. and we'll discuss later :relaxed:

Thanks

TxTony avatar Sep 28 '22 05:09 TxTony

Hi @TxTony!

First question: I think that it would be great if we could test values. What do you think of using a minimal IFC file? We can provide you with one.

Second question: exactly, the functions are used to get the geometric data of a mesh. You can see how we use it in web-ifc-three. If we use the basic IFC file to test, we could request a specific mesh, and then check if the data returned is correct.

Let me know if you have any other question. Thanks a lot for your work on this. πŸ™‚

agviegas avatar Sep 28 '22 09:09 agviegas

This is a first draft https://github.com/TxTony/web-ifc/blob/main/tests/functional/WebIfcApi.spec.ts Do not hesitate to tell me if it smells bad :laughing: . I think it covers all the functions inside web-ifc-api.js, except the functions with the comment // must be reviewed . they are not tested yet or tested the bad way. @agviegas could you provide me a minimalist IFC4 file ? these tests are based on a IFC2x3 File.

If you think these tests are correctly written I will continue with the helpers folder to cover Properties.js and try with different ifc files. image

TxTony avatar Sep 30 '22 17:09 TxTony

By the way if you got some ifc files making ifcApi failed please could you add the links here.

TxTony avatar Oct 01 '22 15:10 TxTony

Fails to consider and should be in a test case

  • https://github.com/IFCjs/web-ifc/issues/209
  • https://github.com/IFCjs/web-ifc/issues/214
  • https://github.com/IFCjs/web-ifc/issues/212
  • https://github.com/IFCjs/web-ifc/issues/146
  • https://github.com/IFCjs/web-ifc/issues/53

TxTony avatar Oct 03 '22 18:10 TxTony

::extend

TxTony avatar Oct 06 '22 08:10 TxTony

🟒🟒🟒

::extend

Hi, @TxTony! The due date is successfully extended by 21 days to October 28, 2022 UTC.

agviegas avatar Oct 06 '22 08:10 agviegas

Hey, sorry for the late response, this looks great! You can find some files here. I think that the tests are correctly written. πŸ™‚

agviegas avatar Oct 09 '22 12:10 agviegas

Hi @agviegas thanks. don't worry i will publish them soon . My timetable is busy i just need to clean the code and include some known faillures. Thanks for the files

TxTony avatar Oct 09 '22 16:10 TxTony

πŸ”΄πŸ”΄πŸ”΄

Hi, @TxTony! The date is past due, your assignment has been revoked. It’s now available for anyone to take.

agviegas avatar Oct 29 '22 00:10 agviegas

Hi @agviegas could you change the status to done if it is ok.

Thanks

TxTony avatar Oct 29 '22 18:10 TxTony

::done

agviegas avatar Oct 31 '22 09:10 agviegas

::expense::105012

TxTony avatar Nov 01 '22 09:11 TxTony