Changeset 20877d2


Ignore:
Timestamp:
Jun 16, 2017, 3:49:27 PM (4 years ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
aaron-thesis, arm-eh, cleanup-dtors, deferred_resn, demangler, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, resolv-new, with_gc
Children:
0892b1b
Parents:
d33bc7c
Message:

I've been sitting on these tests for a while. New tests for maybe/result. Passing on my machine.

Location:
src
Files:
4 added
3 edited

Legend:

Unmodified
Added
Removed
  • src/libcfa/containers/maybe

    rd33bc7c r20877d2  
    1010// Created On       : Wed May 24 14:43:00 2017
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Thr May 25 16:36:00 2017
    13 // Update Count     : 1
     12// Last Modified On : Fri Jun 16 15:42:00 2017
     13// Update Count     : 2
    1414//
    1515
     
    4646bool ?!=?(maybe(T) this, zero_t);
    4747
     48/* Waiting for bug#11 to be fixed.
    4849forall(otype T)
    4950maybe(T) maybe_value(T value);
     
    5152forall(otype T)
    5253maybe(T) maybe_none();
     54*/
    5355
    5456forall(otype T)
  • src/libcfa/containers/result

    rd33bc7c r20877d2  
    1010// Created On       : Wed May 24 14:45:00 2017
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Thr May 25 16:39:00 2017
    13 // Update Count     : 1
     12// Last Modified On : Fri Jun 16 15:41:00 2017
     13// Update Count     : 2
    1414//
    1515
     
    5555bool ?!=?(result(T, E) this, zero_t);
    5656
     57/* Wating for bug#11 to be fixed.
    5758forall(otype T, otype E)
    5859result(T, E) result_value(T value);
     
    6061forall(otype T, otype E)
    6162result(T, E) result_error(E error);
     63*/
    6264
    6365forall(otype T, otype E)
  • src/libcfa/containers/result.c

    rd33bc7c r20877d2  
    7474forall(otype T, otype E)
    7575bool ?!=?(result(T, E) this, zero_t) {
    76         return !this.has_value;
     76        return this.has_value;
    7777}
    7878
     
    100100forall(otype T, otype E)
    101101E get_error(result(T, E) * this) {
    102         assertf(this->has_value, "attempt to get from result without error");
     102        assertf(!this->has_value, "attempt to get from result without error");
    103103        return this->error;
    104104}
Note: See TracChangeset for help on using the changeset viewer.