ThatOpen / engine_web-ifc

Reading and writing IFC files with Javascript, at native speeds.
https://thatopen.github.io/engine_web-ifc/demo
Mozilla Public License 2.0
604 stars 180 forks source link

Automated Test Suite #110

Closed cdiggins closed 1 year ago

cdiggins commented 2 years ago

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.

awmartin commented 2 years ago

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

agviegas commented 2 years ago

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

TxTony commented 1 year ago

::take

agviegas commented 1 year ago

🟒🟒🟒

::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!

TxTony commented 1 year ago

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

agviegas commented 1 year ago

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. πŸ™‚

TxTony commented 1 year ago

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 commented 1 year ago

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

TxTony commented 1 year ago

Fails to consider and should be in a test case

TxTony commented 1 year ago

::extend

agviegas commented 1 year ago

🟒🟒🟒

::extend

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

agviegas commented 1 year ago

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

TxTony commented 1 year ago

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

agviegas commented 1 year ago

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

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

TxTony commented 1 year ago

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

Thanks

agviegas commented 1 year ago

::done

TxTony commented 1 year ago

::expense::105012