From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by c5ff346549e7 (Postfix) with ESMTP id 15CCC2DF5 for ; Mon, 19 Mar 2018 13:28:13 +0000 (UTC) X-IronPort-AV: E=Sophos;i="5.48,330,1517871600"; d="scan'208,217";a="318808095" Received: from sympa.inria.fr ([193.51.193.213]) by mail2-relais-roc.national.inria.fr with ESMTP; 19 Mar 2018 14:28:12 +0100 Received: by sympa.inria.fr (Postfix, from userid 20132) id 368A582418; Mon, 19 Mar 2018 14:28:12 +0100 (CET) Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id 32587823D7 for ; Mon, 19 Mar 2018 14:28:01 +0100 (CET) Authentication-Results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=yawar.amin@gmail.com; spf=Pass smtp.mailfrom=yawar.amin@gmail.com; spf=None smtp.helo=postmaster@mail-io0-f180.google.com IronPort-PHdr: =?us-ascii?q?9a23=3AbQrEAhyhRl/acLXXCy+O+j09IxM/srCxBDY+r6Qd?= =?us-ascii?q?1O8UIJqq85mqBkHD//Il1AaPAd2Araocw8Pt8InYEVQa5piAtH1QOLdtbDQizf?= =?us-ascii?q?ssogo7HcSeAlf6JvO5JwYzHcBFSUM3tyrjaRsdF8nxfUDdrWOv5jAOBBr/KRB1?= =?us-ascii?q?JuPoEYLOksi7ze+/94HdbglSmDaxfa55IQmrownWqsQYm5ZpJLwryhvOrHtIeu?= =?us-ascii?q?BWyn1tKFmOgRvy5dq+8YB6/ShItP0v68BPUaPhf6QlVrNYFygpM3o05MLwqxbO?= =?us-ascii?q?SxaE62YGXWUXlhpIBBXF7A3/U5zsvCb2qvZx1S+HNsDtU7s6RSqt4LtqSB/wiS?= =?us-ascii?q?cIKTg58H3MisdtiK5XuQ+tqwBjz4LRZoyeKfhwcb7Hfd4CR2VBUMZfWSJCDI2h?= =?us-ascii?q?cYUAE/EMMvxEo4TnvVYCsQeyCAuqCejyyjFInHj23agi3usjCw7H0hYvH8gTu3?= =?us-ascii?q?nIqdX1NaESWv2ywajI1zrCYelZ2S3n5IfSdxAhoPeMUKl/ccrU00YvFgfFgk+M?= =?us-ascii?q?poziOjOYz+IAuHWY4ep4Te+jlXIrpgVrrjWsxsogkJfFipwbx1ze6Cl0w5o5KN?= =?us-ascii?q?ulQ0Bhe9GkCoFftySCOot2XMwiR2ZotT4/yrIcuJ67eDEGyJUgxxLDcvCHfZWE?= =?us-ascii?q?7xH/WOqLLjd4g3VleL27hxms60Sv1ur8Vsys3FZLqCpKjMXMu2gT2xDP7sWLUP?= =?us-ascii?q?hw80e71TqRyQze5PtILV03mKbHM5Ihx6Q/lpsXsUTNBC/2n0D2gbeWd0o+9Omn?= =?us-ascii?q?8f7nbq/8qZ+ZNo90jBrzMqsrmsOlAOQ4NhICUHSc+eS5zLHj51H2QK1Wjv0qla?= =?us-ascii?q?nUqIzVKt4epq69GgNV1ocj6w2jDzq9y9QZnXwHLEpfdx6djojpPUvOIPHiAvul?= =?us-ascii?q?jVSsimQj+/eTFLThB5zLZl3Ejr74dKw1v0RVyA86y/hV7pJRA7cEZvn0Xxmims?= =?us-ascii?q?bfC0oIOhO92a7ODdR7ntcPUH2GGOmQNaLUmVCN7+MrZeKLYdlG637GN/E56qu2?= =?us-ascii?q?3jcCklgHcPzshMNPMSHqLrFdO0ycJEHUrJIEGGYOsBA5SbWz2lKHWD9XIX21Wv?= =?us-ascii?q?Blv21pOMedFY7GA7uVrvmZxi7iR89ZY2lHDhaHFnK6L9zZCcdJUzqbJ4paqhJB?= =?us-ascii?q?VbWlTNV/hxSntQu/yr0/a+SNqnVeupXk29x4oebUkENq+A=3D=3D?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0CqAAAmuq9af7TfVdFdHAEBAQQBAQoBA?= =?us-ascii?q?YUoKAqDU4EwlmSDGYd/jhMLhRACgzcHGQcBBDMVAQIBAQEBAQEBAQESAQEJCws?= =?us-ascii?q?IJjGCOCQBgkkGIx0BGx0BAwwGBQQHNwICIgERAQUBHAYThH8BAxWdCzyLCIIEB?= =?us-ascii?q?QEcgwIFg00KGSYNVViCBgIGEoUhghWBVYR0iA6CYQOYNgmBc40+jS2QJg8DHoE?= =?us-ascii?q?JNEiBLDMaI08xghKCI45kJDSQEwEBAQ?= X-IPAS-Result: =?us-ascii?q?A0CqAAAmuq9af7TfVdFdHAEBAQQBAQoBAYUoKAqDU4EwlmS?= =?us-ascii?q?DGYd/jhMLhRACgzcHGQcBBDMVAQIBAQEBAQEBAQESAQEJCwsIJjGCOCQBgkkGI?= =?us-ascii?q?x0BGx0BAwwGBQQHNwICIgERAQUBHAYThH8BAxWdCzyLCIIEBQEcgwIFg00KGSY?= =?us-ascii?q?NVViCBgIGEoUhghWBVYR0iA6CYQOYNgmBc40+jS2QJg8DHoEJNEiBLDMaI08xg?= =?us-ascii?q?hKCI45kJDSQEwEBAQ?= X-IronPort-AV: E=Sophos;i="5.48,330,1517871600"; d="scan'208,217";a="318807997" Received: from mail-io0-f180.google.com ([209.85.223.180]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/AES128-GCM-SHA256; 19 Mar 2018 14:28:00 +0100 Received: by mail-io0-f180.google.com with SMTP id r18so1969049ioa.1 for ; Mon, 19 Mar 2018 06:28:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=QZUcPIPM+Z3a14HtHvXCAbbABCdFDYpv26sUwouA4pA=; b=RC0AjCTjk3x5KjjEHqMqG350qxtWm3cKdSfire1WHvgx6A7oTs1TyNcEP+M3QpEcjm HA3CcKdcN0+oJ2s09fgEz4huIebCtDh9X1Wc3wh1eRxo+w/d4t7EEAYmbN49NJtiZuk3 D72qm6kTvKaoRKFOel1OKotAi6tZpJNnjBQZA+IxLIEl6r4z/Wmin3P2L2Qzc4e8UkwC f6+OcT6Uqr5rtb1N+E+9P0wHWSbB61ZcNMAZf6aNfpKZ1jnJj4WDs8untIR6frdtnnbn i/W9aA0JjE3vk0HX604wVrwsyH/YPigRK/lomOfUAmTQFgdI/MvRdTwl+ecoOWbHxwOc ZdaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=QZUcPIPM+Z3a14HtHvXCAbbABCdFDYpv26sUwouA4pA=; b=Ako6+H3gI247gkZTVPmiyLDPFcYi1X753SreTHW3whWNkRvf3zP7vgHUReecDfOhgx vxfhgVqFER+W4rk420qT1dDAu+HpP6ZpjQL0UG9aaDCloHOzyfiNg9qEyFuvQTIIeile jZVlkN1kIXSOQKVrfyXFAInC4mD6UOtbts1hn/SAAy/fZ7HLtQZansgkFRLIuoy4GwgN NDHjqd6WEp1RMSBfDxUUFGhwDPiS3jDNGhyumMZnu81dYfzqvXSltQ6gAuPt9aL5dGh7 1bkxsNrBBIpU0a7zGQcbYWnNm8UonUw6ueb9swjPKqWnIhBoF6NQQPyMxG63+fou+vCJ ufOA== X-Gm-Message-State: AElRT7GhlRac0yxFXCjws0pITbTONRNeZ4UjxEIeKR8K+XmL0nzLyjdj +zXZkGvqOFTW+TZK2xJ9auVIW+S94/UHhHdwlA== X-Google-Smtp-Source: AG47ELsnpqEoQX884uWEbpIkMRbtj+wNIb6+IFcmgEnWCJwvZLL2rmXI9XOTQXZDS7z70JsbpK9dwM/R5NpkcuHI+yc= X-Received: by 10.107.27.132 with SMTP id b126mr12761963iob.195.1521466079177; Mon, 19 Mar 2018 06:27:59 -0700 (PDT) MIME-Version: 1.0 Received: by 10.192.161.104 with HTTP; Mon, 19 Mar 2018 06:27:38 -0700 (PDT) In-Reply-To: References: From: Yawar Amin Date: Mon, 19 Mar 2018 09:27:38 -0400 Message-ID: To: Bahman Movaqar Cc: Ocaml Mailing List Content-Type: multipart/alternative; boundary="001a113fd7462ff37a0567c3ed31" Subject: Re: [Caml-list] On variants, integers and testing Reply-To: Yawar Amin X-Loop: caml-list@inria.fr X-Sequence: 16734 Errors-to: caml-list-owner@inria.fr Precedence: list Precedence: bulk Sender: caml-list-request@inria.fr X-no-archive: yes List-Id: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: --001a113fd7462ff37a0567c3ed31 Content-Type: text/plain; charset="UTF-8" Hi, On Fri, Mar 16, 2018 at 7:12 AM, Bahman Movaqar wrote: > [...] > Suppose that I wrote this piece of code as a library to be used by others > as well. In such a case, practically the only function that the users are > interested in is `solve`, as defined in the .mli file. > This is good: keeps my library clean, the usage straight-forward and > doesn't confuse the users. > > However, when it comes to testing, things are not that simple. Now that I > have exported only 1 function in the .mli, I can only test that 1 function. > Is this the proper way[2]? > This is a rather philosophical question. Some people like to test only the exposed interface, because that's the only thing that's relevant to users. The internal functionality should be there only to support the external-facing interface, and thus testing the `solve` function *thoroughly* should automatically test all internal functionality. If it doesn't, then maybe that internal functionality shouldn't be there in the first place? But, maybe sometimes you do want to have some internal functionality and you do want to test it. An OCaml can theoretically some of its files (modules) from the outside world by telling its build system to not expose the compiled interface (.cmi) files. This way, you can write and test these internal modules and still hide them from users. I haven't actually usec this technique, but certainly someone in this list might have. Regards, Yawar -- Caml-list mailing list. Subscription management and archives: https://sympa.inria.fr/sympa/arc/caml-list Beginner's list: http://groups.yahoo.com/group/ocaml_beginners Bug reports: http://caml.inria.fr/bin/caml-bugs --001a113fd7462ff37a0567c3ed31 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi,

On Fri, Mar 16, 2018 at 7:12 AM, Bahman Movaqar <bahman@bahmanm.com> wrote:
[...]
Suppose that I wrote th= is piece of code as a library to be used by others as well. In such a case,= practically the only function that the users are interested in is `solve`,= as defined in the .mli file.
This is good: keeps my library clean, the usage straight-fo= rward and doesn't confuse the users.

However, when it comes to testing, things are not that si= mple. Now that I have exported only 1 function in the .mli, I can only test= that 1 function.
Is this the proper way[2]?

This is a rather philosophical question. Some people like to test on= ly the exposed interface, because that's the only thing that's rele= vant to users. The internal functionality should be there only to support t= he external-facing interface, and thus testing the `solve` function thor= oughly should automatically test all internal functionality. If it does= n't, then maybe that internal functionality shouldn't be there in t= he first place?

But, maybe sometimes you do want t= o have some internal functionality and you do want to test it. An OCaml can= theoretically some of its files (modules) from the outside world by tellin= g its build system to not expose the compiled interface (.cmi) files. This = way, you can write and test these internal modules and still hide them from= users.

I haven't actually usec this technique= , but certainly someone in this list might have.

R= egards,

Yawar
--001a113fd7462ff37a0567c3ed31--